Last active
August 29, 2015 14:23
-
-
Save jpbyrne/507907140b2d6abc5654 to your computer and use it in GitHub Desktop.
Updating TableView Height Constraint
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
@IBOutlet weak var tableView: UITableView! | |
@IBOutlet weak var tableViewHeightConstraint: NSLayoutConstraint! | |
var tableViewCell: UITableViewCell = tableView.cellForRowAtIndexPath(NSIndexPath(forRow: 0, inSection: 0)) | |
var cellHeight: CGFloat = tableViewCell?.frame.height | |
var dataSource: [AnyObject]? | |
tableViewHeightConstraint.constant = calculateTableViewHeight(cellHeight, dataSource.count) | |
tableView.setNeedsLayout() | |
tableView.layoutIfNeeded() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment