In UITableView
index bar how to change color of selected index on index bar
I use code like this
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex: (NSInteger)index
{
int i = 0;
for (i = 0; i< [dataArray count]; i++)
{
NSString *letterString = [alphabetsArray objectAtIndex:i];
if ([letterString isEqualToString:title])
{
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:i] atScrollPosition:UITableViewScrollPositionTop animated:YES];
lblSelectedIndex.text = [alphabetsArray objectAtIndex:index];
break;
}
}
return i;
}
it scroll table on that selected index charecter but i need to change color of that selected charecter.Please help.
Actually there is not official Apple available to do that. And Apple may reject you app if you do that. If you just wants to customize indexBar
then below library may help you (It can't customize what you currently wants).
You can use custom library GDIIndexBar
(iOS 6+), which you can customize.
https://github.com/gdavis/GDIIndexBar
Here's sample snippet for GDIIndexBar
GDIIndexBar *indexBar = [[GDIIndexBar alloc] initWithTableView:tableView];
indexBar.delegate = self;
[self.view addSubview:indexBar];
You can customize as per follows:
[[GDIIndexBar appearance] setTextColor:[UIColor redColor]];
[[GDIIndexBar appearance] setTextShadowColor:[UIColor purpleColor]];
[[GDIIndexBar appearance] setTextFont:[UIFont italicSystemFontOfSize:11.5];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With