在iOS 8和更高版本的iPad中,我遇到了一个方向问题。我的应用程序在iPad中同时需要横向右方向和横向左方向。但在使用iOS 8的iPad中,它仅支持横向右方向。如果您尝试更改方向,状态栏的方向将更改,但应用程序的视图控制器方向保持不变。我使用的是Xcode 6.2和swift。我已经在plist中添加了所有方向,并根据需要使用了func shouldAutorotate() -> Bool{} func supportedInterfaceOrientations() -> Int {}方法。请给我一个解决方案。提前谢谢。
发布于 2015-04-06 16:49:10
我只想在iphone中有肖像,在iPad中有所有的模式。重写viewcontroller shouldrotate对我没有帮助。随着研究发现,appdelegate可以处理旋转。请找到下面的code.Hope,它对您有帮助。
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow) -> Int {
var orientation = Int(UIInterfaceOrientationMask.Portrait.toRaw())
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
orientation = Int(UIInterfaceOrientationMask.All.toRaw())
}
return orientation
}
https://stackoverflow.com/questions/29469542
复制相似问题