【发布时间】:2017-04-15 02:30:02
【问题描述】:
我在我正在创建的应用程序中使用.aspectFit,并且由于使用.aspectFit,整个场景不会填满屏幕(这是我想要的)。但是,如果可能的话,我想将黑色背景更改为红色。目前我的场景背景颜色是绿色,背景颜色是黑色(必须是默认的)。
我在互联网上做了一些阅读,有人建议可以在 AppDelegate 中更改黑色背景,但是当我使用下面的代码时似乎没有任何反应(背景颜色仍然是黑色)。
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window?.backgroundColor? = UIColor.red
return true
}
我是否更改了错误的背景颜色,或者我遗漏了什么?任何帮助将不胜感激。
【问题讨论】:
-
您的代码可以流畅运行,但在绿色后面。黑色表示没有任何场景,是系统提供的默认颜色。
-
啊,那你就不能改系统颜色了?
-
黑色比红色好看:)!
-
哈哈是的,我只是将红色(和绿色)用于测试目的。
-
@Jarron 请问你有没有找到解决方案?
标签: swift colors sprite-kit background-color