基本应用
import “UITableView+FDTemplateLayoutCell.h”
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return [tableView fd_heightForCellWithIdentifier:@"reuse identifer" configuration:^(id cell) {
// Configure this cell with data, same as what you've done in "-tableView:cellForRowAtIndexPath:"
// Like: "-tableView:cellForRowAtIndexPath:"中的一些赋值操作,为了提前获取行高
// cell.entity = self.feedEntities[indexPath.row];
}];
下面是我对UITableView+FDTemplateLayoutCell在项目中的运用效果:
当时要做这个界面的自适应的时候也是费了一些劲,但是用了UITableView+FDTemplateLayoutCell再配合 UIView-FDCollapsibleConstraints一起使用,一些就变得简单了。