0

我想为学习目的实现这种自动旋转。

当设备在 iPad 上运行时支持所有方向,在 iPhone 上时不允许自动旋转。

我希望自动旋转适用于iOS5和 iOS6。

我应该写什么代码?

PS。以下方法似乎不起作用:

 - (BOOL) shouldAutorotate
{
    return  ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
}

-(NSUInteger)supportedInterfaceOrientations
{
     if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
     {
         return UIInterfaceOrientationMaskAll;
     }
     else
     {
         return UIInterfaceOrientationMaskPortrait;
     }

}
4

0 回答 0