[英]UITableView section footer not hiding
我使用Interface Builder
创建了一个UITableView
我有一个部分页脚空间,我将自定义视图设计为部分页脚。 但我希望最初隐藏部分页脚并仅在服务调用后加载它。
我努力了
self.tableview.tablefooterview.hidden = YES
self.tableview.sectionFooterHeight = 0.0f
我还在委托方法中设置了高度,但是表页脚视图根本没有隐藏。 如何隐藏表格页脚视图。
检查此链接以了解如何在UITableView中隐藏页脚视图
- (UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section
{
return [[UIView alloc] initWithFrame:CGRectZero];
}
使用UITableView
委托方法: -
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0;
}
请尝试将部分页脚值设置为大于0(零)。 我试着把它设置为0.000001并且它有效。
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.000001;
}
请试试这段代码
- (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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.