对于非分组表,UITableView节标题高度 [英] UITableView section header height for non-grouped table

查看:99
本文介绍了对于非分组表,UITableView节标题高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



有没有办法改变 NON 分组表格的分节标题高度(以及它的大小/字号)?



希望是或至少是可能......但担心这可能是不。有了它,伙计们。

解决方案

是。

委托方法:

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

当然,根据情况进行更改。当然也有一个脚注:

   - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)部分{
返回44;
}


Greetings! I know that UITableView sectionHeaderHeight is only used for grouped tables, but I'll ask anyway (in case there's some way to do this that isn't obvious) ...

Is there a way to change the section header height (and with it, the font/size) for a NON-grouped table?

Hoping "yes" or at least a "maybe" ... but fearing it might be a "no". Have at it, folks.

解决方案

Yes.

Use this delegate method:

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

Of course, change as appropriate. There's of course the one for footer as well:

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

这篇关于对于非分组表,UITableView节标题高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆