【发布时间】:2015-01-09 12:01:28
【问题描述】:
我正在使用UITableView 委托方法viewForHeaderInSection 在我的UITableView 中提供节标题。
我最初创建一个这样的视图:
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 50)];
然后使用 Autolayout 添加一些子视图,然后返回 headerView
我的问题是我不想具体指定 headerView 大小。我想使用 Autolayout 将左右边缘固定到视图的宽度。这是问题所在,我在 Autolayout 代码中没有可使用的超级视图。
使用上面的代码,意味着标题视图不会在旋转时自动调整大小。旋转后必须重新加载 tableview。
有什么想法可以设置 headerView 以将其边缘固定到 tableview?
谢谢
【问题讨论】:
标签: ios objective-c uitableview autolayout