'Can I change title text color in UITableVIew? (swift)

I know it's kinda stupid question, but I have really stuck there. So now I'm trying to make my tableView look better and as you can see I'm using CAGradientLayer to make a custom background for it, but also you can see there a "Events" title above the first cell. And exactly that title color i want to change for color green to fit with another content. enter image description here



Solution 1:[1]

You can use the UITableView.tableHeaderView Property to create a UIView that sits there. With this property you should be able to customise the view/colour however you like. For example:

`var tableHeaderView: UIView? {
   tableHeaderView.backgroundColor = // your colour here
}`

or if you've assigned the view in your storyboard to be a class UITableView then just:

tableView.tableHeaderView?.backgroundColor = // UIColour(...)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joe Williams