Search code examples
iphoneiosios6rotation

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. How can I implement that?


Solution

  • In your ViewControllerA's viewwillappear method set the orientation like

    [[UIDevice currentDevice]setOrientation:UIInterfaceOrientationPortrait];