Value of type AppDelegate has no member 'windows'?

huangapple go评论76阅读模式
英文:

Value of type AppDelegate has no member 'windows'?

问题

我尝试在AppDelegate文件中使用self.window.tintColor来更改tintColor,但XCode给我一个错误,说AppDelegate没有成员Window。我到处搜索如何更改全局tintColor,在每个stackoverflow帖子中,人们都说我们可以在AppDelegate文件中使用该代码来实现。这是错误的屏幕截图:

Value of type AppDelegate has no member 'windows'?

提前感谢。

英文:

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:

Value of type AppDelegate has no member 'windows'?

Thanks in advance.

答案1

得分: 2

将以下内容翻译为中文:

SceneDelegatewillConnectTo方法中添加到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

huangapple
  • 本文由 发表于 2020年1月6日 16:56:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/59609153.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定