UITableView header/footer font color
When overriding the header/footer of a (group styled) table view, what colour should be used for the header and footer fonts to ensure the header and footer fonts are consistent with the standard header and footer fonts?
ie The header is being loaded like this:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
开发者_运维技巧 if(myHeaderView == nil) {
[[NSBundle mainBundle] loadNibNamed: @"MyHeaderView"
owner: self
options: nil];
}
return myHeaderView;
}
From this discussion
Here's the UILabel
info for tableView headers on iOS 6:
Plain
fontName: Helvetica-Bold
pointSize: 18.000000
textColor: UIDeviceWhiteColorSpace 1 1
shadowColor: UIDeviceWhiteColorSpace 0 0.44
shadowOffset: CGSize 0 1
Grouped
fontName: Helvetica-Bold
pointSize: 17.000000
textColor: UIDeviceRGBColorSpace 0.298039 0.337255 0.423529 1
shadowColor: UIDeviceWhiteColorSpace 1 1
shadowOffset: CGSize 0 1
As for the background of the plain style header, that's a UIImage, not simply a backgroundColor. Notice the subtle vertical gradient.
hope it helps
This works for me (for the footer), with some fiddling of the CGFrame of the label, and its numberOfLines it might work for you to:
int height = [self tableView:table heightForFooterInSection:section];
UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, table.bounds.size.width - 20, height)] autorelease];
label.text = [self tableView:table titleForFooterInSection:section];
label.textColor = [UIColor colorWithRed:0.298 green:0.337 blue:0.423 alpha:1.000];
label.font = [UIFont systemFontOfSize:15.0];
label.backgroundColor = [UIColor clearColor];
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0, 1);
label.textAlignment = UITextAlignmentCenter;
label.numberOfLines = 2;
精彩评论