- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionName = nil;
switch (section) {
case 0:
sectionName = [NSString stringWithFormat:@"Header Text 1"];
break;
case 1:
sectionName = [NSString stringWithFormat:@"Header Text 2"];
break;
case 2:
sectionName = [NSString stringWithFormat:@"Header Text 3"];
break;
}
UILabel *sectionHeader = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 40)] autorelease];
sectionHeader.backgroundColor = [UIColor clearColor];
sectionHeader.font = [UIFont boldSystemFontOfSize:18];
sectionHeader.textColor = [UIColor whiteColor];
sectionHeader.text = sectionName;
return sectionHeader;
}
Спасибо за ответ, я попробую его. Но какой размер или высоту я должен использовать? Нужно ли создавать его по коду? Могу ли я использовать раскадровку? Благодаря! – Ricardo
Я нашел эту таблицуView: heightForHeaderInSection: огромное спасибо. – Ricardo