jsaad jsaad - 1 year ago 100
Objective-C Question

Change the color of specific letters in UITableView index alphabet

I need to change the color of specific letter in my UITableview to show that this section is empty. For example, if there are entries for the letter 'a' but not for 'b', I want the letter 'b' to appear, but be black, while the letter 'a' is red.

I know it can be done for the entire alphabet this way:

if ([[[view class] description] isEqualToString:@"UITableViewIndex"]) {
[view performSelector:@selector(setIndexColor:) withObject:[UIColor redColor]];

but can a single letter's color be changed?

Answer Source

You can't change it directly. You need to subclass it.

Check out this github project. It does exactly that:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download