【发布时间】:2012-03-31 13:29:00
【问题描述】:
我在较大的 UIScrollView 中有一个非滚动 UITableView。由于表格视图是非滚动的,我希望它的框架大小总是匹配它的内容大小。
我调用了以下方法:
- (void)resizeTableViewFrameHeight
{
// Table view does not scroll, so its frame height should be equal to its contentSize height
CGRect frame = self.tableView.frame;
frame.size = self.tableView.contentSize;
self.tableView.frame = frame;
}
问题是我必须在错误的时间调用此方法(在设置 contentSize 之前)。我想知道,我可以在 UITableView 上设置一个属性,使其框架始终自动匹配其内容大小吗?
【问题讨论】:
标签: ios uitableview uiscrollview