我在更改 TableView 上的颜色和字体时遇到了一些麻烦,我已将其分成 4 个部分,并带有名称等,我似乎无法让它工作我不确定我做错了什么?
- (NSString *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionName = nil;
switch(section)
{
case 0:
sectionName = [NSString stringWithString:@"Date"];
break;
case 1:
sectionName = [NSString stringWithString:@"Gig"];
break;
case 2:
sectionName = [NSString stringWithString:@"City"];
break;
case 3:
sectionName = [NSString stringWithString:@"Country"];
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 sectionName;
}