Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't the background colour of my Storyboard in Xcode change? It's always the same grey color?

So i've changed the background property of my default view in my storyboard file to as many as the colours in the rainbow. The colour shows up along with my buttons nicely in Xcode, but when I actually RUN the app, the background is always the same, ugly, default grey colour that you start with a new Xcode project ("Hello World!").

I've searched up for the answer all over Google and to no avail. Am I doing something wrong or is it just a glitch? It might be also important to mention than i'm using Spritekit, and that this "view" is the only view in my Storyboard file, the default one. Should I change self.view to skView? Would that work?

Oh and also, when I manually try to change the background colour under viewDidLoad in my .m class by doing:

self.view.backgroundColor = [UIColor backgroundColor]; 

the background STILL doesn't change and is always the same default colour. Please help me... i'm desperate right now... there's no answers anywhere to be found. Thanks.

like image 787
user5849278 Avatar asked Sep 25 '22 13:09

user5849278


1 Answers

All Storyboard, all graphical answer:

Storyboard

Explanation: You should modify the Main.storyboard, select the View Controller, change View in the Attribute Inspector, and apply a new Background color.

With exactly 0 lines of code, you should get this result:

enter image description here

Download project here.

like image 194
SwiftArchitect Avatar answered Oct 11 '22 13:10

SwiftArchitect