开发者

Giving color to the title in tableView in iphone

开发者 https://www.devze.com 2022-12-17 01:34 出处:网络
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:

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 backgou开发者_如何学Gond colour.

please help me out.

Thanks.


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.


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

Could be the method you're looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消