繁体   English   中英

更改部分文字uitableview

[英]change section text uitableview

我正在寻找一种方法来更改UITableView中的section headers 我一直在浏览网络和这个论坛,但找不到答案。 这种性质的大多数主题都围绕更改section header title字体和颜色。

因此,在tableview中填充了3个部分:Section 1,Section 2,Section 3 现在如何将这些标题更改为我想要的名称?

菲利浦

您可以如下更改UITableView节标题

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    NSString *name;
    switch (section)
        {
        case 0:
            name = firstHeader;
            break;
        case 1:
            name =  secondHeader;
            break;

        default:
            name = @"";
            break;
    }    
    return name;
}

更新:当您收到对UITableView中任何部分的修改时,为什么不调用此方法来更新该部分

 - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation

这将以漂亮的动画更新“选定”部分

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM