问候!我知道,的UITableView sectionHeaderHeight 仅用于分组表,但我会问反正(如果有一些方法可以做到这一点并不明显)...

是否有一种方法来改变节头高度(和与它,字体/大小)要的 NON -grouped表?

希望能“是”或至少是“可能” ......但担心它可能是一个“不”。有它,人

有帮助吗?

解决方案

使用此委托方法:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 44;
}

当然,适当改变。当然还有一个为页脚以及:

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 44;
}

其他提示

至少从iOS的9(测试)的 UITableView.sectionHeaderHeight 正在为纯表视图(非分组),以及!

您会得到一个缺省头高度(通常为22.0)。

当然意见表代表可能自定义在其的的tableView此默认值:heightForHeaderInSection:方式

在下面的代码段给出了一个定义节头的高度:

CGFloat headerHeight = self.tableView.sectionHeaderHeight;
if ([self.tableView.delegate respondsToSelector:@selector(tableView:heightForHeaderInSection:)]) {
    // possibly custom header height
    headerHeight = [self.tableView.delegate tableView:self.tableView heightForHeaderInSection:indexPathForCell.section];
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top