I creating UIButton like that:

```
okBtn = UIButton()
okBtn.setTitle("OK", for: .normal)
okBtn.setTitle("OK", for: .selected)
okBtn.titleLabel?.textColor = .purpleLight
okBtn.backgroundColor = .red
okBtn.addTarget(self, action: #selector(didTapOKBtn), for: .touchUpInside)
self.addSubview(okBtn)

```

However, color is not setted, i added a screen to show how it looks.

[![enter image description here](https://i.stack.imgur.com/GQupi.png)](https://i.stack.imgur.com/GQupi.png)