Question

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.

Was it helpful?

Solution

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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top