I am having a problem changing the section title for my grouped uitableview. I tried everything. I was wondering if this is a bug with a simulator or something else? I am running the latest version of xcode and developing for the iPad.
Here is my table header code
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UILabel *label = [[[UILabel alloc] init] autorelease];
label.frame = CGRectMake(20, 6, 300, 30);
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor whiteColor];
label.shadowColor = [UIColor grayColor];
label.shadowOffset = CGSizeMake(0.0, 1.0);
label.font = [UIFont boldSystemFontOfSize:14];
label.text = @"hello";
return label;
}
When I compile, it just displays without headers. I also tried adding a view here as well, as per the code below
UIView *sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
sectionView.backgroundColor = [UIColor redColor];
[sectionView autorelease];
[sectionView addSubview:label];
return sectionView;
Am I doing something wrong?
source
share