我有一个导航控制器,它以纵向方式通过它。然后,在某个时刻,我推到一个显示图形的视图,我只想以横向显示,甚至根本不以纵向显示(这搞砸了视图的外观)。
在这个视图中,GraphViewController,我有以下方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
当视图第一次被推送时,它以纵向模式出现。如果我旋转手机,视图也会旋转成横向(而不是倒置纵向)。但我希望它永远不要处于纵向模式,即使它启动时也不行。我已经验证通过添加 NSLog 来调用此方法。