【问题标题】:UITableView section footer not hidingUITableView 部分页脚不隐藏
【发布时间】:2017-01-24 09:29:15
【问题描述】:
我使用Interface Builder 创建了一个UITableView 我有一个节页脚空间,我将我的自定义视图设计为节页脚。但我希望最初隐藏部分页脚,并且仅在服务调用后加载它。
我试过了
self.tableview.tablefooterview.hidden = YES
self.tableview.sectionFooterHeight = 0.0f
我还在委托方法中设置了高度,但表尾视图根本没有隐藏。如何隐藏表格页脚视图。
【问题讨论】:
标签:
ios
objective-c
uitableview
interface-builder
tablefooterview
【解决方案1】:
查看此链接以了解如何Hide footer view in UITableView
- (UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section
{
return [[UIView alloc] initWithFrame:CGRectZero];
}
【解决方案2】:
使用UITableView委托方法:-
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0;
}
【解决方案3】:
请尝试将节页脚值设置为大于 0(零)。我尝试将其设置为 0.000001,它可以工作。
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.000001;
}
【解决方案4】:
请试试这个代码
- (void)viewDidLoad
{
self.tableview.sectionHeaderHeight = 0.0;
self.tableview.sectionFooterHeight = 0.0;
self.tableview.tableHeaderView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)];
self.tableview.tableFooterView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0;
}