Friday 28 October 2011

Formatting of titleforHeaderInSection


- (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section {
 UILabel *sectionHeader = [[[UILabel alloc] initWithFrame:CGRectNull] autorelease];
 sectionHeader.backgroundColor = [UIColor clearColor];
 sectionHeader.textAlignment = UITextAlignmentLeft;
 sectionHeader.font = [UIFont boldSystemFontOfSize:10];
 sectionHeader.textColor = [UIColor whiteColor];
 sectionHeader.text = [[plistArray objectAtIndex:section]objectForKey:@"Header"]; // <-- allows loading of sectionHeader text from a plist
 return sectionHeader;
}
- (CGFloat)tableView:(UITableView *)tableViewheightForHeaderInSection:(NSInteger)section {
 return 40;
} 

No comments:

Post a Comment