英文:
Value of type AppDelegate has no member 'windows'?
问题
我尝试在AppDelegate文件中使用self.window.tintColor
来更改tintColor,但XCode给我一个错误,说AppDelegate没有成员Window。我到处搜索如何更改全局tintColor,在每个stackoverflow帖子中,人们都说我们可以在AppDelegate文件中使用该代码来实现。这是错误的屏幕截图:
提前感谢。
英文:
I'm trying to change the tintColor in the AppDelegate file with the self.window.tintColor
but XCode gives me an error saying that AppDelegate doesn't have a member Window. I searched everywhere how to change the global tintcolor and in every stackoverflow post people say we can do it using that code in the AppDelegate file. Here is a screenshot of the error:
Thanks in advance.
答案1
得分: 2
将以下内容翻译为中文:
在SceneDelegate
的willConnectTo
方法中添加到Xcode 11中:
guard let _ = (scene as? UIWindowScene) else { return }
self.window?.tintColor = .red
英文:
It's xcode 11 add it inside willConnectTo
of SceneDelegate
guard let _ = (scene as? UIWindowScene) else { return }
self.window?.tintColor = .red
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论