【发布时间】:2014-12-23 06:58:16
【问题描述】:
我的自定义单元格中有一个动态高度的UIlabel,高度值是通过方法计算的:
- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes context:(NSStringDrawingContext *)context
然后我通过传递之前计算的值来调用以下方法:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
但是,问题是我不能简单地设置label.frame = newFrame 以适应其内容,因为自动布局。
而且,我不想对故事板中的元素设置太多限制。我真正需要的是像lable.constraint.height = newHeight 这样的单行代码,有什么想法吗?
【问题讨论】:
标签: ios uilabel autolayout constraints