自定义Section
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *v = [UIView new];
v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, NEWWIDTH, 30)];
[v setBackgroundColor:[Common hexStringToColor:@"e4e4e4"]];
UILabel *labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(15,0,v.width,v.height)];
[labelTitle setBackgroundColor:[Common hexStringToColor:@"e4e4e4"]];
labelTitle.textAlignment = NSTextAlignmentLeft;
labelTitle.font = [UIFont systemFontOfSize:12];
labelTitle.textColor = [UIColor darkGrayColor];
if (section == 0) {
labelTitle.text = @"乘车人";
}else if (section == 1){
labelTitle.text = @"订单信息";
}
[v addSubview:labelTitle];
return v;
}
直接返回Title的话
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return @"lalalala"
}