I have a table and simply want the header to be drawn in the same font that is used when I look at it in Interface Builder, when using the grouped table style (e.g. "California" in the attached screen shot).
My understanding is that even to just have a simple text title for a heading I need to implement
and create a UILabel -- is that correct? Seems like a lot of work when you just want to supply simple text for the header, but oh well.
So I have done that, but my question is what specific font is used in Interface Builder that I want to use, and also what text color is that? My current code looks like this, but does not look quite the same:
My understanding is that even to just have a simple text title for a heading I need to implement
Code:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
So I have done that, but my question is what specific font is used in Interface Builder that I want to use, and also what text color is that? My current code looks like this, but does not look quite the same:
Code:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UILabel* hdr = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 280, 40)] autorelease];
hdr.textAlignment = UITextAlignmentCenter;
hdr.font = [UIFont systemFontOfSize:16.0];
hdr.opaque = YES ;
hdr.textColor = [UIColor darkGrayColor];
hdr.text = NSLocalizedString(@"my-header-title",@"");
hdr.backgroundColor = [UIColor clearColor];
return hdr ;
}