处理iPad设备定位的最佳方式

时间:2012-09-29 04:52:49

标签: iphone

  

可能重复:
  iphone/ipad orientation handling

请原谅。我是iOS的新手。你能告诉我处理设备方向的最佳方法吗?

我的意思是在方向改变时替换子视图。

2 个答案:

答案 0 :(得分:0)

请在发布任何问题之前先做一些RnD。这是适用于iOS的任何平台的最佳网站。这个问题已经得到解答了。因为你是一只新蜜蜂,没关系。

以下是link,您可以试试这个。希望它对你有用:)

答案 1 :(得分:0)

在IOS 6中,新方法可以让您了解Device Orientation

此方法用于支持设备方向UIInterfaceOrientationMaskAll表示它将支持所有4个方向。

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

当您的设备改变当前方向时,将调用此方法。

-(BOOL)shouldAutorotate
{
   if(UIInterfaceOrientationPortrait == [[UIDevice currentDevice] orientation])                  
   {
      NSLog(@"Portrait Mode");
   }
   else if(UIInterfaceOrientationPortraitUpsideDown == [[UIDevice currentDevice] orientation])
   {
      NSLog(@"Portrait UpSideDown Mode");
   }
   else if(UIInterfaceOrientationLandscapeLeft == [[UIDevice currentDevice] orientation])
   {
      NSLog(@"Landscape Left Mode");
   }
   else
   {
      NSLog(@"Landscape Right Mode");
   }
   return YES;
}

有关{IOS 6 Interface Orientation in IOS

UIInterfaceOrientation的更多信息,请参阅此链接
相关问题