0
我想要的是iPhone的纵向方向和iPad应用程序的横向方向。 我的应用程序的目标是>ios5
我在网上搜索了这个,但得到了不同的答案,但不是确切的答案。不同的初始界面方向iPhone和iPad通用应用程序
我想要的是iPhone的纵向方向和iPad应用程序的横向方向。 我的应用程序的目标是>ios5
我在网上搜索了这个,但得到了不同的答案,但不是确切的答案。不同的初始界面方向iPhone和iPad通用应用程序
因此,这里是我做过什么
对于iPhone
,并为iPad
而对于iPad的控制器,我添加下面的代码,这是没有必要的ios6应用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
你应该可以做只需将此代码添加到您的应用程序代理。
斯威夫特代码:
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int {
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
return Int(UIInterfaceOrientationMask.Portrait.rawValue)
} else {
return Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue | UIInterfaceOrientationMask.LandscapeRight.rawValue)
}
}