为什么Xcode中我的Storyboard的背景颜色没有变化?它总是一样的灰色? [英] Why doesn't the background colour of my Storyboard in Xcode change? It's always the same grey color?

查看:1063
本文介绍了为什么Xcode中我的Storyboard的背景颜色没有变化?它总是一样的灰色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我将故事板文件中默认视图的背景属性更改为彩虹中的颜色。在Xcode中,颜色与我的按钮很好地显示,但是当我实际运行应用程序时,背景总是相同的,丑陋的,默认的灰色,你从一个新的Xcode项目(Hello World!)开始。

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!").

我已经在Google上搜索了答案,但无济于事。我做错了什么还是只是一个小故障?提起我可能也很重要,因为我正在使用Spritekit,而且这个视图是我的Storyboard文件中的唯一视图,默认视图。我应该将self.view更改为skView吗?这会有用吗?

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?

哦,当我手动尝试在我的.m类中的viewDidLoad下更改背景颜色时:

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]; 

背景STILL不会改变,并且始终是相同的默认颜色。请帮助我......我现在很绝望......没有任何答案可以找到。谢谢。

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.

推荐答案

所有故事板,所有图形答案:

All Storyboard, all graphical answer:

< a href =https://i.stack.imgur.com/49zWT.png =nofollow noreferrer>

说明:您应该修改 Main.storyboard ,选择 View Controller ,在属性检查器中更改查看,并应用新的背景颜色。

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

如果完全 0行代码,您应该得到以下结果:

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

下载项目这里

这篇关于为什么Xcode中我的Storyboard的背景颜色没有变化?它总是一样的灰色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆