IOS cell自定义高度

iOS 未知技术 并不完善


TableView CollectionView 的 cell '自排序' -> self Sizing Cells

注意点:1.为原型单元格定义Auto Layout约束

2.指定表视图的estimatedRowHeight

3.将表视图的rowHeight属性设置 UITableViewAutomaticDimension

tableView.estimatedRowHeight = 44.0

tableView.rowHeight = UITableViewAutomaticDimension

若发现第一个没有自动调整,界面滚动之后才能调整,写下面代码

override func viewDidAppear(animated: Bool) {

tableView.reloadData()

}


永远不用实现- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath方法和- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath方法。

你可能感兴趣的:(IOS cell自定义高度)