Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default TableView section header background color on the iPhone?

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.

like image 297
Igor Avatar asked Jan 05 '12 12:01

Igor


People also ask

How do you put a background color on a header?

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.

What is Uitableview in Swift?

A view that presents data using rows in a single column.


3 Answers

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)
like image 90
Rasputin Avatar answered Nov 02 '22 19:11

Rasputin


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];**

}
like image 26
Darshan Panchal Avatar answered Nov 02 '22 21:11

Darshan Panchal


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)
like image 32
Atpl Mohali Avatar answered Nov 02 '22 21:11

Atpl Mohali