IOStableviewsectionSet

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    if (tableView == self.searchDisplayController.searchResultsTableView)
    {
        return nil;
    }
    UIView *headView = [[[UIView alloc]init]autorelease];
    headView.backgroundColor = [UIColor clearColor];
    if (section!=0)
    {
        //标题背景
        UIView *biaotiView = [[[UIView alloc]init]autorelease];
        biaotiView.backgroundColor = BB_White_Color;
        biaotiView.frame=CGRectMake(0, 0, 320, 30);
        [headView addSubview:biaotiView];
         
        //标题文字
        UILabel *lblBiaoti = [[[UILabel alloc]init]autorelease];
        lblBiaoti.backgroundColor = [UIColor clearColor];
        lblBiaoti.textAlignment = NSTextAlignmentLeft;
        lblBiaoti.font = [UIFont systemFontOfSize:15];
        lblBiaoti.textColor = [UIColor blackColor];
        lblBiaoti.frame = CGRectMake(15, 7.5, 200, 15);
        lblBiaoti.text = [headerList objectAtIndex:section-1];
        [biaotiView addSubview:lblBiaoti];
    }
    return headView;
}
posted @ 2015-07-24 21:51  小毛驴  阅读(224)  评论(0编辑  收藏  举报