I want to customize TableView section header and to leave default background color. I use - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)
section. I need to change font size depending on device (iPad or iPhone). For this purpose call next function:
[UIColor colorWithHue:0.6 saturation:0.33 brightness: 0.69 alpha:0.6].
But I found these values manually.
To add background color in HTML, use the CSS background-color property. Set it to the color name or code you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a table, heading, div, or span tag.
A view that presents data using rows in a single column.
The default tableview section header background color for ios7 is
Objective-C
[UIColor colorWithRed:247/255.0f green:247/255.0f blue:247/255.0f alpha:1.0f]
Swift
UIColor(red: 247/255, green: 247/255, blue: 247/255, alpha: 1)
For Change background Color of TableView Header Section Just One Line stuff
add TableView
delegate willDisplayHeaderView
:
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
**header.tintColor = [UIColor whiteColor];**
}
Objective-C:
[UIColor colorWithRed:232/255.0f green:233/255.0f blue:237/255.0f alpha:1.0f]
Swift:
UIColor(red: 232/255, green: 233/255, blue: 237/255, alpha: 1)
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