【发布时间】:2017-10-16 08:01:24
【问题描述】:
使用此代码允许媒体播放器在全屏时横向旋转(应用程序不支持):
// handle orientation for the device
func application (_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
guard let vc = (window?.rootViewController?.presentedViewController) else {
return .portrait
}
if (vc.isKind(of: NSClassFromString("AVFullScreenViewController")!)) || (vc.isKind(of: NSClassFromString("YTPlayerView")!)) {
return .allButUpsideDown
} else {
return .portrait
}
}
在 ios 10 中工作正常,但由于 ios 11 离开全屏后屏幕不会向后旋转,因此不会调整 UI 大小(旋转后应用程序将只占一半屏幕)。 似乎对 avkit 进行了一些修改,但我找不到这方面的任何资源,想法?
【问题讨论】: