Warrior
Warrior

Reputation: 39384

Giving color to the title in tableView in iphone

I am new to iPhone development. I want to change the colour of the title to brown. In default it is in gray colour. To display the title I am using the following method:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return @"Title";
}

I want to change the title backgound colour.

please help me out.

Thanks.

Upvotes: 0

Views: 787

Answers (2)

Matt Long
Matt Long

Reputation: 24486

You will have to create a UIView subclass that closely represents what is provided by default. Then change the color of your label. Then you can implement:

- (UIView *)tableView:(UITableView *)tableView 
                viewForHeaderInSection:(NSInteger)section;

Which should return your custom view.

Upvotes: 3

natanavra
natanavra

Reputation: 2150

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger) section

Could be the method you're looking for.

Upvotes: 2

Related Questions