Created
April 29, 2020 11:19
-
-
Save kishikawakatsumi/612cbcf756ce6c0a1a0afd8fb5bb2825 to your computer and use it in GitHub Desktop.
Auto sizing UITableView header
This file contains hidden or 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
... | |
headerView.translatesAutoresizingMaskIntoConstraints = false | |
tableView.tableHeaderView = headerView | |
NSLayoutConstraint.activate([ | |
headerView.topAnchor.constraint(equalTo: tableView.topAnchor), | |
headerView.widthAnchor.constraint(equalTo: tableView.widthAnchor), | |
headerView.centerXAnchor.constraint(equalTo: tableView.centerXAnchor)]) | |
tableView.tableHeaderView?.layoutIfNeeded() | |
tableView.tableHeaderView = headerView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
メモ
https://twitter.com/omochimetaru/status/1255470607636070400