- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] init];
//设置 title 区域
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, tableView.contentSize.width, 20)];
//设置 title 文字内容
titleLabel.text = @"标题内容";
//设置 title 颜色
titleLabel.textColor = [UIColor colorWithRed:221/255.0 green:61/255.0 blue:47/255.0 alpha:1];
[view addSubview:titleLabel];
return view;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
//设置 title 区域高度
return 40.f;
}
效果图: