AppDelegate类型的值没有成员'window'?

问题描述 投票:0回答:1

我正在尝试使用self.window.tintColor更改AppDelegate文件中的tintColor,但是xCode给我一个错误,指出AppDelegate没有成员window ...我到处搜索了如何更改全局tintcolor人们说我们可以使用AppDelegate文件中的代码来做到这一点。这是错误的屏幕截图:

enter image description here

swift appdelegate swift5
1个回答
0
投票
这是xcode 11,将其添加到willConnectToSceneDelegate

guard let _ = (scene as? UIWindowScene) else { return } self.window?.tintColor = .red

© www.soinside.com 2019 - 2024. All rights reserved.