//Section的标题栏高度 -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if (section == 0) return 46; else return 30.0f; } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { CGRect headerFrame = CGRectMake(0, 0, 300, 30); CGFloat y = 2; if (section == 0) { headerFrame = CGRectMake(0, 0, 300, 100); y = 18; } UIView *headerView = [[UIView alloc] initWithFrame:headerFrame]; UILabel *dateLabel=[[UILabel alloc] initWithFrame:CGRectMake(20, y, 240, 24)];//日期标签 dateLabel.font=[UIFont boldSystemFontOfSize:16.0f]; dateLabel.textColor = [UIColor darkGrayColor]; dateLabel.backgroundColor=[UIColor clearColor]; UILabel *ageLabel=[[UILabel alloc] initWithFrame:CGRectMake(216, y, 88, 24)];//年龄标签 ageLabel.font=[UIFont systemFontOfSize:14.0]; ageLabel.textAlignment=UITextAlignmentRight; ageLabel.textColor = [UIColor darkGrayColor]; ageLabel.backgroundColor=[UIColor clearColor]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.dateFormat = @"MM dd,yyyy"; dateLabel.text = [NSString stringWithFormat:@"%@",[dateFormatter stringFromDate:[NSDate date]]]; ageLabel.text = @"1岁 2天"; [headerView addSubview:dateLabel]; [headerView addSubview:ageLabel]; return headerView; }