I would like to change the background color of my app programmatically, not IB. Is it possible to get both a Swift and Obj-C answer.
You can set the backgroundColor
property of whatever view it is you have on screen.
In Objective-C:
self.view.backgroundColor = [UIColor redColor];
In Swift:
self.view.backgroundColor = .red
or if it's the main window you're after,
In Objective-C:
self.window.backgroundColor = [UIColor redColor];
In Swift:
self.window.backgroundColor = .red
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With