Ios 通用应用程序以纵向模式启动,即使它';它仅限于风景
无论何时在iPad上运行模拟,即使它在常规设置和代码中被限制为横向模式,它都会在纵向模式下启动,然后切换到横向模式。问题是,当它启动时,所有游戏对象都会在方向改变之前被绘制到屏幕上,从而导致对象被绘制到查看区域下方。当iPad以横向模式启动模拟时,一切正常。我怎样才能防止这种情况发生 GameViewController.swift中的我的代码:Ios 通用应用程序以纵向模式启动,即使它';它仅限于风景,ios,ipad,swift,sprite-kit,screen-orientation,Ios,Ipad,Swift,Sprite Kit,Screen Orientation,无论何时在iPad上运行模拟,即使它在常规设置和代码中被限制为横向模式,它都会在纵向模式下启动,然后切换到横向模式。问题是,当它启动时,所有游戏对象都会在方向改变之前被绘制到屏幕上,从而导致对象被绘制到查看区域下方。当iPad以横向模式启动模拟时,一切正常。我怎样才能防止这种情况发生 GameViewController.swift中的我的代码: override func supportedInterfaceOrientations() -> Int { return Int(U
override func supportedInterfaceOrientations() -> Int {
return Int(UIInterfaceOrientationMask.Landscape.rawValue)
}
对于swift3.0
要限制不同视图的不同方向,需要执行以下操作:
应用程序内委托文件:
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
if self.window?.rootViewController?.presentedViewController is OtherViewController {
return UIInterfaceOrientationMask.All;
} else {
return UIInterfaceOrientationMask.Portrait;
}
}
我解决了。您必须进入support files文件夹中的info.plist,手动删除Supported interface options(ipad)下的所有肖像项目。或者,您也可以将“横向”选项移到列表的顶部。