更改TableView标头文本颜色 [英] Change TableView Header Text Color

查看:72
本文介绍了更改TableView标头文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在tableView中进行简单的更改。我有一个自定义表格视图背景,我想更改页眉和页脚文本颜色,

I would like to make a simple change in my tableView. I have a custom table view background and I would like to change the Header and Footer TEXT color,

仅更改文本颜色。

我在互联网上看到,通常我们必须使用委托方法为表格视图提供一个全新的视图,但我只能更改文本颜色(并且,如果可能的话) ,阴影)...

I've seen on internet that usually we must use the delegate method to give to the table view an entire new view but I would ONLY to change the text color (and, if possibile, the shadow)...

是否有一种简单的方法来做到这一点避免创建新的整个视图

Is there a simple way to do this avoiding create a new entire view?

请帮助我。

谢谢

推荐答案

如果您希望以除自定义字符串之外的任何方式自定义页眉/页脚,则需要创建UIView。

If you want the header/footer to be customized in any way other than just a custom string, you will need to create a UIView.

这是记录在 UITableViewDataSource 文档:

tableView:titleForHeaderInSection:

tableView:titleForHeaderInSection:

讨论
表格视图的节使用固定字体样式标头标题。如果要使用其他字体样式,请在委托方法tableView:viewForHeaderInSection:中返回自定义视图(例如,UILabel对象)。

Discussion The table view uses a fixed font style for section header titles. If you want a different font style, return a custom view (for example, a UILabel object) in the delegate method tableView:viewForHeaderInSection: instead.

这篇关于更改TableView标头文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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