0
votes

supportedInterfaceOrientation should be called only once when viewDidLoad, but in my case it is called every time the simulator rotates.

I need only two orientations potrait and portrait upside down.

when i rotate to upside down the supported interface orientation is called 4 times and my view becomes upside down. on rotation to landscape it is called only once(but it shouldn't ?).

Any solution ?

PS: I am not using any Navigation controller so setting rotation equal to top view controller wont matter. And in my pList only 2 orientations are supported

Also I have a main View Controller in which I add subviews and I have set the supported interface orientation in my view controller.

Weird thing is 3 view controllers that are before(presented before) the faulty one, they rotate just fine.

2

2 Answers

1
votes

You can check the interfaceOrientation in viewDidLoad. You can get the interfaceOrientation with self.userInterFaceOrientation.

Maybe it would be better to check the interfaceOrientation in viewWillAppear.

The difference is, that viewDidLoad will only called one and viewWillAppear every time you enter that view.

1
votes

Its so Simple you just click on your Project -> Summary -> Supported Interface Orientations. You can click the Interface Orientations as your requirements.