作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的 AppDelegate 中,我使用了一个函数来旋转我的设备并锁定方向。
iPhone 只能竖屏,iPad 只能横屏。
它适用于 iPhone,但在 iPad 上永远不会调用以下函数:
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
print("Test")
return AppDelegate.orientationLock
}
我认为它在我切换到“SwiftUI Life Cicle”之前在 iPad 上工作,但我不确定这是否是它停止工作的时间点:
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
对于 iPad,info.plist 也设置为“Landscape only”,但应用程序仍然以纵向模式启动,这也很奇怪:
最佳答案
关于swift - AppDelegates 函数 "supportedInterfaceOrientationsFor"不会在 iPad 上被调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66041654/
在我的 AppDelegate 中,我使用了一个函数来旋转我的设备并锁定方向。 iPhone 只能竖屏,iPad 只能横屏。 它适用于 iPhone,但在 iPad 上永远不会调用以下函数: func
我是一名优秀的程序员,十分优秀!