UITableView sectionIndexTrackingBackgroundColor
@property(nonatomic, retain) UIColor *sectionIndexTrackingBackgroundColor
Discussion of [UITableView sectionIndexTrackingBackgroundColor]
Table views can display an index along the side of the view, making it easier for users to navigate the contents of the table quickly. This property specifies the color to display in the background of the index when the user drags a finger through it.
UITableView sectionIndexTrackingBackgroundColor example.
As of iOS 6.0 there are two methods that allow you to change the color of the section indexes and the background shown when you drag the scrubber.
if ([tableView respondsToSelector:@selector(setSectionIndexColor:)]) {
tableView.sectionIndexColor = ... // some color
tableView.sectionIndexTrackingBackgroundColor = ... // some other color
}
if ([tableView respondsToSelector:@selector(setSectionIndexColor:)]) {
tableView.sectionIndexColor = ... // some color
tableView.sectionIndexTrackingBackgroundColor = ... // some other color
}
Example of [UITableView sectionIndexTrackingBackgroundColor].
if ([_tableView respondsToSelector: @selector(setSectionIndexColor: )]) ////ios6
{
self.tableView.sectionIndexColor = [UIColor whiteColor];
self.tableView.sectionIndexTrackingBackgroundColor = [UIColor clearColor];
}
else
{
/*
for(UIView *view in [self.tableView subviews])
{
if([view respondsToSelector: @selector(setIndexColor: )])
{
[view performSelector: @selector(setIndexColor: ) withObject:[UIColor redColor]];
[view performSelector: @selector(setIndexBackgroundColor: ) withObject:[UIColor clearColor]];
}
}
//*/
}
{
self.tableView.sectionIndexColor = [UIColor whiteColor];
self.tableView.sectionIndexTrackingBackgroundColor = [UIColor clearColor];
}
else
{
/*
for(UIView *view in [self.tableView subviews])
{
if([view respondsToSelector: @selector(setIndexColor: )])
{
[view performSelector: @selector(setIndexColor: ) withObject:[UIColor redColor]];
[view performSelector: @selector(setIndexBackgroundColor: ) withObject:[UIColor clearColor]];
}
}
//*/
}