PDA

View Full Version : TableView header issue




99miles
Apr 6, 2009, 10:11 PM
I have a TableView of type: UITableViewStyleGrouped

In viewForHeaderInSection I return a UILabel:

UILabel* hdr = [[[UILabel alloc] initWithFrame:CGRectMake(40, 0, 280, 40)] autorelease];
hdr.opaque = YES ;
[hdr setTextColor:[UIColor whiteColor]];
UIFont *textHeaderFont = [UIFont fontWithName:@"Arial-BoldMT" size:16];
hdr.font = textHeaderFont;
hdr.backgroundColor = [UIColor clearColor];
hdr.text = @"title";
return hdr ;

... but it is not indented. It's x location is 0.

If I return a UITableViewCell the header is indented but there's about a 1 pixel white space just below it.

I can't figure out how to solve either problem. Any ideas?
Thanks!