问题
I have a UITableView
in Xcode in my project and I set rowHeight
to be 44
in StoryBoard
.
In iOS7 everything is fine but in iOS8 rowHeight returns a value of -1 which cause my table view not being displayed.
回答1:
In iOS 8, Apple introduces a new feature for UITableView known as Self Sizing Cells. If you want to display dynamic content in table view with variable height, you would need to calculate the row height manually.
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
Here is demo http://www.appcoda.com/self-sizing-cells/
来源:https://stackoverflow.com/questions/25915716/xcode-6-ios-8-uitableview-rowheight-property-returns-1