soo*_*per 20 cocoa-touch objective-c uitableview ios
我在SO上的另一个帖子中读到,您可以在添加CALayer的UITableView中调整索引栏(即AZ#滚动条)的字体或背景颜色.我的应用程序将在iOS 5及更高版本上运行,因为我在Apple文档中没有看到任何相关内容,如果没有创建自定义表格视图,这是不可能的?
如果这是可能的(并且Apple可以接受),我将如何做到这一点?
rma*_*ddy 43
从iOS 6.0开始,有两种方法可以让您更改截面索引的颜色以及沿截面索引拖动时显示的背景.
if ([tableView respondsToSelector:@selector(setSectionIndexColor:)]) {
tableView.sectionIndexColor = ... // some color
tableView.sectionIndexTrackingBackgroundColor = ... // some other color
}
Run Code Online (Sandbox Code Playgroud)
当然,这仅在设备具有6.0或更高版本时才会执行.在iOS 5.x下,什么都不会改变.
这是swift 2+的代码
self.tableView.sectionIndexTrackingBackgroundColor = CustomColor
// background color while the index view is being touched
self.tableView.sectionIndexBackgroundColor = CustomColor
// title/text color of index items
self.tableView.sectionIndexColor = CustomColor
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8311 次 |
最近记录: |