开发者社区 问答 正文

UITableViewCell 如何获取自身高度

如题,我在代码中构建cell,在UITableView的delegate中用heightForRow的delegate方法来确定cell高度。

那么如何在cell中获取这个高度来进行里面的内容的布局呢

展开
收起
a123456678 2016-07-27 16:06:24 2814 分享 版权
1 条回答
写回答
取消 提交回答
  • CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
    return size.height + 1.0f; // Add 1.0f for the cell separator height
    2019-07-17 20:00:46
    赞同 展开评论
问答地址: