如何更改分组的UITableView标头的高度? [英] How to change height of grouped UITableView header?
本文介绍了如何更改分组的UITableView标头的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何在表格视图中更改节标题的高度.但是我找不到在第一节之前更改默认间距的任何解决方案.
I know how to change the height of the section headers in the table view. But I am unable to find any solution to change the default spacing before the first section.
现在我有以下代码:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section == 0){
return 0;
}
return 10;
}
推荐答案
似乎无法设置高度为0的表头视图.我最终做了以下事情:
It appears that I can't set a table header view with height of 0. I ended up doing the following:
- (void)viewWillAppear:(BOOL)animated{
CGRect frame = self.tableView.tableHeaderView.frame;
frame.size.height = 1;
UIView *headerView = [[UIView alloc] initWithFrame:frame];
[self.tableView setTableHeaderView:headerView];
}
这篇关于如何更改分组的UITableView标头的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文