Rotate to Portrait Orientation when back button pressed

烂漫一生 提交于 2019-12-08 09:58:31

问题


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. 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]; but this is a hidden API method :-(


回答1:


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

and then return true then your only that view will rotate.



来源:https://stackoverflow.com/questions/5361799/rotate-to-portrait-orientation-when-back-button-pressed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!