【问题标题】:Problem on autorotate for UITabBarController and modal viewsUITabBarController 和模式视图的自动旋转问题
【发布时间】:2010-06-09 09:35:11
【问题描述】:

我在打开和关闭 ModalView 时遇到问题:当用户触摸按钮打开视图或触摸按钮关闭视图时,控制台中会出现此消息:

对于所有界面方向,视图控制器从 _shouldAutorotateToInterfaceOrientation: 返回 NO。它应该至少支持一个方向。

ModalView 与 UITableViewController 相关联,包含在 UINavigationController 中,而 UINavigationController 又插入到 UITabBarController 中。我不明白如何解决这个问题。

【问题讨论】:

    标签: iphone uitabbarcontroller autorotate modalviewcontroller


    【解决方案1】:

    现在这已经很老了,但以防万一它对某人有所帮助:您的代码可能如下所示:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
        return NO;
    }
    

    问题在于你本质上是说你的视图不支持任何方向:)

    它应该看起来像这样:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
        // Support portrait only
        return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
    }
    

    微不足道,但也许这对将来的某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2011-09-10
      • 2010-11-03
      • 2010-11-06
      • 1970-01-01
      • 1970-01-01
      • 2010-11-28
      • 1970-01-01
      • 2010-11-14
      • 1970-01-01
      相关资源
      最近更新 更多