How to tint the sections in your UITableVIew

TableSectionsTo make those sections in a UITableView stand out a bit, you can give them a different colour tint.

Add a new method in your table view delegate and paint with numbers:

The above will create colours in RGB, and values between 0.0 and 1.0 are allowed.

Or, if you’d rather show a picture instead (as a pattern or because you have a nice colour swatch), grab it from your project and turn it into a colour like so:

– (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {

UIColor *niceColour = [UIColor colorWithPatternImage:[UIImage imageNamed:@”NiceColour”]];
view.tintColor = niceColour;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.