方法如下:
-(UIView*) tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section
{
UIView*headerView =[[[UIView alloc] initWithFrame:CGRectMake(0,0, tableView.bounds.size.width,30)] autorelease];
if(section == integerRepresentingYourSectionOfInterest)
[headerView setBackgroundColor:[UIColor redColor]];
else
[headerView setBackgroundColor:[UIColor clearColor]];
return headerView;
}
转载于:https://www.cnblogs.com/tx8899/archive/2013/03/02/2940125.html