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;

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Leave a Reply

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