现在的位置: 首页 > 综合 > 正文

IOS 设置Section的背景色和字体颜色

2018年02月14日 ⁄ 综合 ⁄ 共 491字 ⁄ 字号 评论关闭

如题: 设置Section的背景色和字体颜色

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
    // 设置section背景颜色
    view.tintColor = [UIColor groupTableViewBackgroundColor];
    
    // 设置section字体颜色
    UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
    [header.textLabel setTextColor:Theme_SelectedColor];
}

以此类推,还可以设置header.textLabel
的字体、位置等等。

简单的就这样设置,复杂的就自己画一个:。

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;

抱歉!评论已关闭.