关于UITableViewAutomaticDimension的产生的bug

 

一、下面这句代码要想有作用 在iOS11之前需要适配,两个代理都需要实现

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return UITableViewAutomaticDimension;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section{
    return 60;
}

二、今天又发现heightForRow代理方法也不起作用,猜测跟上面是一个意思,试了一下果然

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}
原文地址:https://www.cnblogs.com/chglog/p/11556196.html