I have a strange problem in an iPhone app I'm developing. I want my app to support ONLY portrait mode, but for some reason I can't do it (device & simulator).
To support only portrait mode I did as follow:
- In the TARGET summary section on Xcode, I chose only portrait.
- All my ViewControllers implements
shouldAutorotateToInterfaceOrientation
But as I said it won't work, and the strange result is that the app support ALL the orientations (portrait, upside down, landscape left, landscape right).
Any ideas?
this how I implement shouldAutorotateToInterfaceOrientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
NSLog(@"Checking orientation %d", interfaceOrientation);
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
I notice just now that when I rotate the phone I get this message:
"Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation."
What does it means?
NSLog(@"Checking orientation %d", interfaceOrientation);
to yourshouldAutorotateToInterfaceOrientation
methods. Are any of them being called when you rotate the simulator or your device? – FatedUIInterfaceOrientationPortrait
, which is what you're expecting. If that really happens when you're rotating to landscape, this is weirder than ever: the device returns YES because it thinks it's rotating to portrait. Can you post a completeshouldAutorotateToInterfaceOrientation
method? – FateddidAnimate...
methods should have no effect.shouldAutorotateToInterfaceOrientation:
is all that matters. What gets logged if you turn your device to each of the four orientations? Does it displayChecking orientation 1
four times? – FatedshouldAutorotateToInterfaceOrientation:
methods all contain this logging statement? – FatedUITabBarController
is itself a ViewController. The default implementation seems to respond toshouldAutorotateToInterfaceOrientation:
by querying its subviews, but if you created your own subclass ofUITabBarController
, it may have its own version. Did you subclassUITabBarController
? – Fated