From what I can say, unfortunately, it is not possible to adjust the color of the text displayed in the index, the closest I could come with is the ability to change the background color and font of the index.
Erica Sadun's iPhone Developers cookbook has code that shows how to access the UITableViewIndex view (an undocumented class). You can find a link to it on page 175 of the book, if you have one. This gives access to the background color and font. You can see an unofficial document related to this class here .
WARNING This is an undocumented use of an undocumented class, so you need to be careful in using it.
Here is the code snippet from the cookbook with a few changes:
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath { for(UIView *view in [tv subviews]) { if([[[view class] description] isEqualToString:@"UITableViewIndex"]) { [view setBackgroundColor:[UIColor whiteColor]]; [view setFont:[UIFont systemFontOfSize:14]]; } }
This illustrates how you can access and view the UITableViewIndex and change it in some aspects. It appears that the view does not have any subheadings, so it probably does some sort of custom drawing with an array of index headers.
This is not perfect, but hopefully it helps a bit.
Floor
paulthenerd Apr 17 '09 at 2:44 2009-04-17 02:44
source share