[英]Unwanted UIView Autorotating: Navigation Controller Push
我有一个导航 controller ,它通过纵向。 然后,在某个时刻,我推到一个显示图形的视图,我只想以横向显示,甚至根本不以纵向显示(这搞砸了视图的外观)。
在这个视图中,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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.