简体   繁体   English

按下后退按钮时旋转至纵向

[英]Rotate to Portrait Orientation when back button pressed

Hey, I have an issue were I allow one viewcontroller to be displayed in portrait and landscape, however when the user hits the back button I want to switch the apps orientation back to portrait. 嘿,我有一个问题是我允许一个ViewController以纵向和横向显示,但是当用户单击“后退”按钮时,我想将应用的方向切换回纵向。 At present if the user hits the back button when its in landscape mode the rest of the application stays in landscape mode, has anyone came across a solution for auto-rotating? 目前,如果用户在横向模式下单击后退按钮,则应用程序的其余部分保持横向模式,是否有人遇到过自动旋转的解决方案?

[EDIT] [编辑]

The effect is similar to what occurs when use [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait]; 效果类似于使用[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait]; but this is a hidden API method :-( 但这是一个隐藏的API方法:-(

What I got from your question is you want to rotate only one view portrait and landscape. 我从您的问题中得到的是,您只想旋转一幅肖像和风景。 If that is what you want, then just go to method - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 如果那是您想要的,那么只需转到方法-(BOOL)应该AutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

and then return true then your only that view will rotate. 然后返回true,那么您唯一的那个视图将旋转。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM