xib自定义cell高度:
从网上找到的方法。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat
heightc= [cell.
contentView
systemLayoutSizeFittingSize
:
UILayoutFittingCompressedSize
].
height
;
}
其实这个xib自定义cell高度和代码自定义cell高度是一个原理,代码自定义高度无非是在模型里面首先确定当前cell的高度。然后将height放入controller确定其高度即可。
xib则是将cell的设置放在heightForRowAtIndexPath方法中即可。