UITableViewAutomaticDimension not working in Xcode 6.3

六眼飞鱼酱① 提交于 2019-12-03 10:23:53

I simply added UITableViewAutomaticDimension to estimatedrowforindexpath as well. You can see how it works on the BEAM App (under 'people' category).

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

Estimated row height needs to be provided.

It is better not to implement estimatedHeightForRowAtIndexPath: unless necessary.

estimatedRowHeight is cheaper provided you can come up with a value

    tableView.rowHeight = UITableViewAutomaticDimension
    tableView.estimatedRowHeight = 30 //Provide any appropriate value
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!