【发布时间】:2015-04-07 16:23:02
【问题描述】:
我已经通过 interfacebuilder 向我的 tableViewCell 添加了一个 textView。但是我想将大小设置为等于 textView 中的内容。这似乎不起作用。到目前为止,我已经完成了以下操作,它不会改变 textView 的框架
var size: CGSize = cell.titleViewLabel.systemLayoutSizeFittingSize(cell.titleViewLabel.contentSize)
var frame: CGRect = cell.titleViewLabel.frame
frame.size.height = size.height
cell.titleViewLabel.frame = frame
【问题讨论】:
-
你在使用自动布局吗?为什么不只是设置一些定位约束并让内在内容大小接管。