Iphone 不需要的UIView自动旋转:导航控制器推送

Iphone 不需要的UIView自动旋转:导航控制器推送,iphone,objective-c,uinavigationcontroller,autorotate,Iphone,Objective C,Uinavigationcontroller,Autorotate,我有一个导航控制器,它通过肖像。然后,在某一点上,我推到一个显示图形的视图,我只想在横向中显示图形,甚至根本不想在纵向中显示图形(这会搞乱视图的外观) 在这个视图中,GraphViewController有以下方法: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations

我有一个导航控制器,它通过肖像。然后,在某一点上,我推到一个显示图形的视图,我只想在横向中显示图形,甚至根本不想在纵向中显示图形(这会搞乱视图的外观)

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

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
首次推送视图时,它将以纵向模式显示。如果我旋转手机,视图也会旋转成横向(而不是倒立的纵向)。但我希望它永远不要处于肖像模式,甚至在它启动时也不要。我已经通过添加NSLog验证了调用此方法


我看到了,但没能让它工作。谢谢

不,我想说的是,这没用。我的视图仍然以纵向模式打开。而且,你给了我(实际上)与我在上面发布的代码相同的代码。我确实试过了,但同样的事情发生了:当视图被推送时,它处于纵向模式。你成功地让它工作了吗?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}