Custom XLForm Section background color

375 Views Asked by At

I wish to change the BackgroundColor of a Section (or the Form) within an XLForm.


Section - Multi Valued Row Template.

section.multivaluedRowTemplate.cellConfig[@"backgroundColor"] = kBackgroundColor;


With a row

row.cellConfigAtConfigure[@"backgroundColor"] = kBackgroundColor;

1

There are 1 best solutions below

0
Alex Hedley On BEST ANSWER

Thanks to a reply on GitHub from @mats-claassen


Code

- (void)viewDidLoad {
    [[self tableView] registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:@"headerFooterReuseIdentifier"];
}

Header

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UITableViewHeaderFooterView *headerFooterView = [[self tableView] dequeueReusableHeaderFooterViewWithIdentifier:@"headerFooterReuseIdentifier"];
    headerFooterView.contentView.backgroundColor = kBackgroundColor;

    return headerFooterView;
}

Footer

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UITableViewHeaderFooterView *headerFooterView = [[self tableView] dequeueReusableHeaderFooterViewWithIdentifier:@"headerFooterReuseIdentifier"];
    headerFooterView.contentView.backgroundColor = kBackgroundColor;

    return headerFooterView;
}