Ios5 方向在ios 5中不起作用,但在ios 6中起作用

Ios5 方向在ios 5中不起作用,但在ios 6中起作用,ios5,orientation,Ios5,Orientation,在我的tabbar控制器应用程序中,我有许多视图。所以我对我的tabbar控制器进行了如下子分类 -(BOOL)shouldAutorotate { return [[self.viewControllers lastObject] shouldAutorotate]; } -(NSUInteger)supportedInterfaceOrientations { return [[self.viewControllers lastObject] support

在我的tabbar控制器应用程序中,我有许多视图。所以我对我的tabbar控制器进行了如下子分类

   -(BOOL)shouldAutorotate
 {

   return [[self.viewControllers lastObject] shouldAutorotate];
  }

    -(NSUInteger)supportedInterfaceOrientations
  {
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
 }

  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
   {
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
   }

  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation            { 
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return (UIInterfaceOrientationMaskAll);


}
在我看来,控制器也是如此

 - (BOOL)shouldAutorotate
{
return YES;
 }

 - (NSUInteger)supportedInterfaceOrientations
{
   return (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskLandscapeLeft|UIInterfaceOrientationMaskLandscapeRight);

//OR return (UIInterfaceOrientationMaskAll);
 }

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation          {
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return (UIInterfaceOrientationMaskAll);



  }
    - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
 {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
    toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{

}
else
{

}
   }
我的问题是,入职培训在ios 6中工作,而在ios 5中不工作。
谢谢。

在ios 5的视图控制器中添加此代码

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return  UIInterfaceOrientationMaskLandscape | UIInterfaceOrientationMaskPortrait;

}

您应该在每个选项卡栏页面中编写此函数

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation          {

return YES;

}
//仅在需要时使用此选项

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{

//your view changing code

}

感谢您的回复,它正在工作。请您澄清一下它是如何工作的,哪些方法是先调用的,我完全困惑了我还有一个问题,假设我的选项卡栏有两个视图,如果我点击第二个视图,然后旋转并返回到第一个视图,我的所有按钮和标签都会受到干扰,当我从portriat旋转到横向viceversa时,is view将显示方法将调用。所有选项卡都类似于主视图的子视图,这就是为什么每个选项卡中都需要AutoRotateTointerFaceOrientation的原因。我不想在我旋转时调用该方法。有什么方法吗?要排列标签,应在视图中设置框将显示