我想使用 SceneDelegate、UIWindowScene、UIWindowSceneDelegate 和其他 UIScene 相关的东西。
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow.init(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
let vc = UIStoryboard(name: "FCBottomTabBar", bundle: nil).instantiateInitialViewController()!
window?.rootViewController = vc
window?.makeKeyAndVisible()
}
如何动态锁定此窗口的方向?例如portrait
仅用于?动态意味着在运行时当用户与某物交互时,方向锁定回所有。
例如,对于屏幕 A,我只需要锁定纵向。对于屏幕 B 仅横向。