2

我的项目中有一个in Xcode ,UITableView我设置rowHeight44.StoryBoard

在 iOS7 中一切都很好,但在 iOS8 rowHeight 返回值-1导致我的表格视图不显示。

4

1 回答 1

3

在 iOS 8 中,Apple 为 UITableView 引入了一项称为 Self Sizing Cells 的新功能。如果要在可变高度的表格视图中显示动态内容,则需要手动计算行高。

tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension

这是演示http://www.appcoda.com/self-sizing-cells/

于 2014-09-18T14:45:56.940 回答