我想显示一个索引 TableView 。
默认情况下,章节索引标题为灰色。
我如何改变它们的颜色?
最佳答案
编辑/跟进 iOS7(2013 年 9 月)阅读 Graham Perks 的回答以了解 iOS7 的跟进,他在其中解释了 sectionIndexTrackingBackgroundColor
和 sectionIndexBackgroundColor
为 future 的读者跟进(2012 年 9 月)这个问题。
自 iOS 6 以来,现在可以更改索引颜色文本和背景。为此提供了两个函数(请参阅 iOS 6 文档)。
sectionIndexColor
用于 TableView 索引文本的颜色。
@property(nonatomic, retain) UIColor *sectionIndexColor
表格 View 可以在 View 的一侧显示索引,使用户可以更轻松地快速浏览表格内容。此属性指定用于此区域中显示的文本的颜色。
可用性:适用于 iOS 6.0 及更高版本。
声明于:UITableView.h
sectionIndexTrackingBackgroundColor
用于 TableView 索引背景区域的颜色。
@property(nonatomic, retain) UIColor *sectionIndexTrackingBackgroundColor
表格 View 可以在 View 的一侧显示索引,使用户可以更轻松地快速浏览表格内容。此属性指定当用户将手指拖过索引时在索引背景中显示的颜色。
可用性:适用于 iOS 6.0 及更高版本。
声明于:UITableView.h
关于ios - 如何更改章节索引标题的字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6662301/