Reputation: 19727
Is tableView:viewForHeaderInSection:
the best way to adjust the font color in a UITableViewCell's header section?
I'd like to simply adjust the font color (ideally) without having to define a UIView
. I'm especially reluctant to use the above method since the alignment of section headers has given me trouble in the past.
Upvotes: 3
Views: 3115
Reputation: 81
tableView:viewForHeaderInSection: returns a UIView. You have to create a UIView, add an UILabel into the UIView, and adjust the font for the UILabel.
For example:
{
UIView *headerView = [[[UIView alloc]
initWithFrame:CGRectMake(0,0,self.view.frame.size.width, 30)] autorelease];
UILabel *label = [[UILabel alloc] initWithFrame:headerView.frame];
label.font = [UIFont systemOfFontWithSize:12];
....
return headerView;
}
Upvotes: 3