Skip to content

Instantly share code, notes, and snippets.

@lm2s
Last active September 27, 2018 15:31
Show Gist options
  • Save lm2s/53ba34de098c2db0a081712ef2209c8a to your computer and use it in GitHub Desktop.
Save lm2s/53ba34de098c2db0a081712ef2209c8a to your computer and use it in GitHub Desktop.
[Bottom UITableView] UITableBottom attached to bottom #swift #ios

Usage:

Set leading/trailing/bottom anchors to superview, top greaterThanEqual to superview

Done.

class IntrinsicTableView: UITableView {
override var contentSize:CGSize { didSet { self.invalidateIntrinsicContentSize() }
}
override var intrinsicContentSize: CGSize {
self.layoutIfNeeded()
return CGSize(width: UIView.noIntrinsicMetric, height: contentSize.height)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment