How to support only portrait mode on an iPhone app

Eyal picture Eyal · Apr 5, 2012 · Viewed 8.5k times · Source

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?

Answer

Eric picture Eric · Apr 5, 2012

On the Target Summary choose portrait only.