2013-08-17 43 views
0

我想,如果我旋转ipad的 我在我的代码中使用旋转在ipad上我的iPhone应用程序是:当启用旋转选项旋转在ipad我的iPhone应用程序

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAll; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation 
{ 
    return (orientation == UIInterfaceOrientationMaskAll); 
} 

和我检查肖像和景观: enter image description here

和plist文件:

enter image description here

我应用器件系列是仅适用于iPhone,并显示在iPad设备的iphone

但它不旋转,请纠正我上面的代码,谢谢

+0

您使用的是iOS 5吗? – iAhmed

回答

0

你问吧? ;

如果([[的UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){ }

放入代码,如果重试。

+0

你没有得到我 – Fatima

0

在.plist文件中,您只能指定启动方向。之后,每个视图控制器可以实现shouldAutorotateToInterfaceOrientation:其中视图控制器被“问”,如果旋转到另一个方向是可以接受的。在iPad应用程序的标准模板中,这总是返回YES,因此允许所有方向。在你的情况下,当给定的方向是UIInterfaceOrientationLandscapeLeft时,你可能只会返回YES,尽管你应该看看是否可以支持两种风景方向,因为苹果人机界面指导强烈建议至少支持两种风景方向(如果支持)。

请注意,应用中的每个视图控制器都必须指定其自己的方向,因为它可能比其他视图更受限制。

有关此更多信息,看看:

支持orrientations的iPad应用程序:http://developer.apple.com/library/ios/#qa/qa1689/_index.html

为什么不会我的UIViewController与设备旋转:http://developer.apple.com/library/ios/#qa/qa1688/_index.html

UIViewController类参考:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html