`
158067568
  • 浏览: 326976 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

IOS UITableView 自定义Section

阅读更多

- (UIView *) tableView:(UITableView *)tableView1 viewForHeaderInSection:(NSInteger)section
{
   
    NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
    if (sectionTitle == nil) {
        return  nil;
    }
   
    UILabel * label = [[[UILabel alloc] init] autorelease];
    label.frame = CGRectMake(0, 0, 320, 22);
//    label.backgroundColor = [UIColor clearColor];
//    label.backgroundColor = [UIColor redColor];
    label.font=[UIFont fontWithName:@"Helvetica-Bold" size:14];
    label.text = sectionTitle;
   
    UIView * sectionView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 220)] autorelease];
    [sectionView setBackgroundColor:[UIColor blackColor]];
    [sectionView addSubview:label];
    return sectionView;
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics