动态改变CELL 的高度

来源:互联网 发布:海陆丰制毒村 知乎 编辑:程序博客网 时间:2024/05/01 22:29


- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath {
   UITableViewCell *cell = [selftableView:tableViewcellForRowAtIndexPath:indexPath];
   
if (cell == nil) {
       
return 0;
    }
   
return cell.height;
}

从上面的代码可以看出,在设置cell高的时候,会先对cell进行创建,赋值,从而获得cell的高度

其实就是先创建cell,把值给cell,排列好了,返回高度

在celll里面设置高度,然后这个就可以获得高度。

0 0