您的位置:首页 > 产品设计 > UI/UE

自定义UITableView的Section的title的样式

2013-12-18 07:24 393 查看
这是设置rFooter的Section
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 21.0f;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    NSString *sectionTitle = [selftableView:tableView
titleForFooterInSection: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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: