3

我有一个导航控制器,它以纵向方式通过它。然后,在某个时刻,我推到一个显示图形的视图,我只想以横向显示,甚至根本不以纵向显示(这搞砸了视图的外观)。

在这个视图中,GraphViewController,我有以下方法:

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

当视图第一次被推送时,它以纵向模式出现。如果我旋转手机,视图也会旋转成横向(而不是倒置纵向)。但我希望它永远不要处于纵向模式,即使它启动时也不行。我已经验证通过添加 NSLog 来调用此方法。

我看到了这些 帖子,但无法让它发挥作用。谢谢!!

4

1 回答 1

0
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
于 2011-07-04T05:19:41.157 回答