You should get the outlet of the buttons to edit its properties. What you have got is a action of that button for the a particular event like touchUpInside
.
You should get the Outlet of the button like this:
@IBOutlet weak var sampleButton: UIButton!
and then set the backgroundColor
in the viewDidLoad()
:
sampleButton.backgroundColor = UIColor.orange
solved Xcode 8: fix for error (has no member ‘backgroundColor’) [closed]