- (UIView *)tableView:(UITableView *)tableView 

viewForHeaderInSection:(NSInteger)section

{

    UIView *headerView = [[UIViewalloc] initWithFrame:CGRectMake(10, 0, 300, 30)];//创建一个视图  

    UIImageView *headerImageView = [[UIImageViewalloc] initWithFrame:CGRectMake(10, 0, 300, 30)];

    UIImage *image = [UIImageimageNamed:@"4-2.png"];

    [headerImageView setImage:image];

    [headerView addSubview:headerImageView];

    [headerImageView release];

    UILabel *headerLabel = [[UILabelalloc] initWithFrame:CGRectMake(130, 5, 150, 20)];

    headerLabel.backgroundColor = [UIColorclearColor];

    headerLabel.font = [UIFontboldSystemFontOfSize:15.0];

    headerLabel.textColor = [UIColorblueColor];

    headerLabel.text = @"Section";

    [headerView addSubview:headerLabel];

    [headerLabel release];

    

    return headerView;

}//自定义section的头部

相关文章:

  • 2021-06-20
  • 2021-11-19
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
  • 2022-01-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案