【问题标题】:Iphone Tabbar application not rotatingIphone Tabbar应用程序不旋转
【发布时间】:2012-03-25 03:15:59
【问题描述】:

我创建了一个标签栏应用程序。首先启用了旋转。该应用程序确实旋转没有任何困难。但为了更好地使用,我评论了所有自动旋转代码,并且在 infoplist 中删除了除肖像之外的所有其他界面。但现在我需要它回来。我取消了所有代码的注释并添加了所有界面方向。但应用程序没有旋转。请任何人帮助我。对不起我的英语不好

谢谢 拉克什

【问题讨论】:

  • 如果tabBarController的任何一个viewControllers不允许旋转,其他的也不会旋转。像这样。
  • 我应该给什么代码?
  • 感谢 Roman Temchecnko 答案是正确的。问题是我没有把它交给每个视图控制器

标签: iphone ios ios4 iphone-sdk-3.0


【解决方案1】:
create a category like this and this method
   @implementation UITabBarController(UITabBarControllerCategory)

 -(BOOL)shouldAutorotateToInterfaceOrientation:
  (UIInterfaceOrientation)toInterfaceOrientation
{
   AppDelegate *appDelegate = (AppDelegate *)[[UIApplication     sharedApplication]delegate];

   if ([AppDelegate isLandScapeOnly]){



      return NO;
 }
    return YES;
 }

 @end

【讨论】:

    【解决方案2】:

    添加到标签栏控制器的每个视图控制器都会有

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

    确保在每个选项中都返回 YES。

    【讨论】:

    • 对不起,伙计们,我明白了 Shubhank 谢谢你的帮助,我没有把它交给所有的视图控制器,现在它已经解决了
    猜你喜欢
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 2012-12-27
    • 2012-09-24
    • 1970-01-01
    • 1970-01-01
    • 2011-05-01
    • 1970-01-01
    相关资源
    最近更新 更多