iOS cell使用xib自动高度问题 笔记

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xjh093/article/details/88228551

0x01 问题

cell用的xib,在一个地方高度正确,在另一个地方不正确.

高度代理方法:

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

0x02 解决

加上另外一个代理方法

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

一行代码,在任何 view 内进行 Push、Present

https://github.com/xjh093/JHPP


猜你喜欢

转载自blog.csdn.net/xjh093/article/details/88228551