1

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

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

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

4

1 回答 1

1

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

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

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

它应该看起来像这样:

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

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

于 2011-03-14T21:29:53.957 回答