自定义UITableView的Section的title的样式

来源:互联网 发布:不用实名的域名 编辑:程序博客网 时间:2024/05/16 05:17

这是设置rFooter的Section

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section

{

    return 21.0f;

}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section

{

    NSString *sectionTitle = [selftableView:tableViewtitleForFooterInSection:section];

    if (sectionTitle == nil) {

        return nil;

    }

    UILabel *label = [[UILabelalloc]init];

    label.frame = CGRectMake(20,8,320, 21);

    label.lineBreakMode=NSLineBreakByWordWrapping;

    label.numberOfLines=0;

    label.backgroundColor = [UIColorclearColor];

    label.textColor = [UIColorlightGrayColor];

    label.font = [UIFontboldSystemFontOfSize:13];

    label.text = sectionTitle;

    

    UIView *view = [[UIViewalloc]init];

    [view addSubview:label];

    return view;

}

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section

{

    switch (section) {

        case 0:

            return @"";

            break;

        case 1:

            return@"XXXXXXXXXXXXX";

            break;

        case 2:

            return @"";

            break;

        default:

            return @"";

            break;

    }

}

设置rFooterInSection


原创粉丝点击