Is there a way to change the Section Header and footer background color without using any custom Views or xib?
I don't know if there is a Eureka-specific/approved method, but the willDisplayHeaderView delegate does the trick for me:
    func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
        if let header = view as? UITableViewHeaderFooterView {
            header.backgroundView?.backgroundColor = UIColor.green
            header.textLabel?.textColor = UIColor.yellow
        }
    }
works for headers that are shown like this:
        var section = Section()
        section.header = HeaderFooterView(stringLiteral: "Ugly Header")
        form +++ section
FWIW, there is a Eureka way using onSetupView but as of release 3.1 I think it may be broken.
            var hfv = HeaderFooterView(stringLiteral: "Ugly Header")
            hfv.onSetupView = { view, _ in
                if let header = view as? UITableViewHeaderFooterView {
                     header.backgroundView?.backgroundColor = .yellow
                }
            }
            section.header = hfv
I don't know if there is a Eureka-specific/approved method, but the willDisplayHeaderView delegate does the trick for me:
func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) { if let header = view as? UITableViewHeaderFooterView { header.backgroundView?.backgroundColor = UIColor.green header.textLabel?.textColor = UIColor.yellow } }works for headers that are shown like this:
var section = Section() section.header = HeaderFooterView(stringLiteral: "Ugly Header") form +++ section
Hi @eliburke I tried this method and the background color doesn't work, but the text color works. Are u able to make it work? I'm using Eureka 4.3.0
Most helpful comment
I don't know if there is a Eureka-specific/approved method, but the willDisplayHeaderView delegate does the trick for me:
works for headers that are shown like this: