Gal*_*Gal 17 header uitableview ios7
我正在构建我的设置屏幕并使用分组表视图.在尝试设置标题时,我看到标题视图上方的间距.我仔细检查了一下,我确实传递了正确的视图高度-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section.
以下是此行为的屏幕截图:

你可以看到我的视图中的标题(VIBRATE,SILENT MODE),它的颜色更深,bg颜色更亮.
Cas*_*sey 73
经过多次搜索,我终于找到了解决方法.tableview的委托需要实现heightForFooterInSection并返回一个非常小的数字.返回0默认为导致额外空格的相同间距.
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return CGFLOAT_MIN;
}
Run Code Online (Sandbox Code Playgroud)
试试这个:
- (void)viewWillAppear:(BOOL)animated{
CGRect frame = self.tableView.tableHeaderView.frame;
frame.size.height = 1;
UIView *headerView = [[UIView alloc] initWithFrame:frame];
[self.tableView setTableHeaderView:headerView];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16045 次 |
| 最近记录: |