简体   繁体   English

iOS6旋转问题:从另一个视图控制器弹出时,使我的视图保持直立

[英]iOS6 rotation issue: make my view stick to portrait when pop back from another view controller

I have two viewcontrollers, ViewControllerA supports both landscape and portrait, click a button in ViewControllerA push into ViewControllerB, which supports landscape only, then I make the phone in the landscape direction and then pop back to ViewControllerA, by default A is in landscape mode now, but I want it to be portrait first in this situation. 我有两个ViewController,ViewControllerA同时支持横向和纵向,在ViewControllerA中单击一个按钮,将其推入ViewControllerB(仅支持横向),然后将手机沿横向方向移动,然后弹回ViewControllerA,默认情况下A处于横向模式,但在这种情况下,我希望它首先成为肖像。 How can I implement that? 我该如何实施?

在您的ViewControllerAviewwillappear方法中,将方向设置为

[[UIDevice currentDevice]setOrientation:UIInterfaceOrientationPortrait];

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

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