我想隐藏我的 UITableView 部分的页眉和页脚,我目前正在这样设置它们:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.0;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return nil;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return nil;
}
如您在屏幕截图中所见,这已成功隐藏页脚,但未隐藏页眉(显示为灰色)。缺少什么?
最佳答案
方法 heightForHeaderInSection
不适用于 0。试试这个:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 0.0001f;
}
关于ios - 如何以编程方式隐藏我的 UITableViews 部分的标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34778090/