Created
March 25, 2020 03:28
-
-
Save Maxatma/1ad31dabffc3815d2f533ab1b25bf40e to your computer and use it in GitHub Desktop.
Self-resizing tableview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IntrinsicTableView: UITableView { | |
override var contentSize: CGSize { | |
didSet { | |
self.invalidateIntrinsicContentSize() | |
} | |
} | |
override var intrinsicContentSize: CGSize { | |
self.layoutIfNeeded() | |
return CGSize(width: UIView.noIntrinsicMetric, height: contentSize.height + 20) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment