How to change font color of section index titles

In iOS 7, to change the normal background color use the sectionIndexBackgroundColor property.

sectionIndexTrackingBackgroundColor is the background color while tracking with your finger.

(Thanks to HpTerm for the initial pointers which work great on iOS 6.)


Add the below code in your viewDidLoad (for swift):

tableView.sectionIndexColor = UIColor.lightGrayColor()

EDIT/FOLLOW UP iOS7 (Sept. 2013) Read answer of Graham Perks for a follow up on iOS7 where he explains about sectionIndexTrackingBackgroundColor and sectionIndexBackgroundColor


Follow up (Sept. 2012) of this question for future readers.

Since iOS 6 it is now possible to change the index color text and background. Two functions are available for that (see iOS 6 documentation).


sectionIndexColor

The color to use for the table view’s index text.

@property(nonatomic, retain) UIColor *sectionIndexColor

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 use for text displayed in this region.

Availability : Available in iOS 6.0 and later.

Declared In : UITableView.h


sectionIndexTrackingBackgroundColor

The color to use for the table view’s index background area.

@property(nonatomic, retain) UIColor *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.

Availability : Available in iOS 6.0 and later.

Declared In : UITableView.h