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)
}
}