繁体   English   中英

如何自定义UITableView中的节的UIView?

[英]How to customize UIView of sections in UITableView?

我想在UITableView中设置样式,例如viewForFooterInSectionviewForHeaderInSection

我只能使用titleForHeaderInSection设置标题,使用heightForHeaderInSection设置高度,但是我想设置背景颜色,字体大小,字体颜色等。

有可能吗?

您可以使用apple提供的委托方法来做到这一点。

//for header 
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
     UIView *myview = [[UIView alloc] init];
    //give size for veiw, background color, add label anything here



    return myview;
}


//for footer

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView *myview = [[UIView alloc] init];
    //give size for veiw, background color, add label anything here



    return myview;
}

暂无
暂无

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

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