Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sweetooth44

macrumors newbie
Original poster
I'm sure this isn't new, but I'm having a few small issues with getting my app to play nicely under iOS 6. I'm sure it's an easy fix; I just can't get it working properly. My app:

On iPhone —*only works in portrait + portrait upside down
On iPad —*works in all orientations

Here is the code I've been using:
Code:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
	
	UIDevice* thisDevice = [UIDevice currentDevice];
    
	if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad)
	{
		return YES;
	}
    else
    {
    return (orientation != UIDeviceOrientationLandscapeLeft) &&
	(orientation != UIDeviceOrientationLandscapeRight);
    }
}

What should I change it to?
 
Can't you change that to
Code:
UIInterfaceOrientationIsPortrait(orientation);
instead of the orientation !=
Hope that helped.
What I tend to use is DeviceHW, is a tool to check if you are on iPad etc, it contains class methods, so instead of recreating the UIDevice thing, you can just go like
Code:
if ([DeviceHW isiPad]) {
Blah
} else {
Blah
}

You can also write this yourself ^_-
Or you can write a handler for the orientations, so you don't have to repeat it in each controller.
 
On your project settings, on your target, you can select what sides it should be able to rotate, also should be in your project plist. Sure it's alright there? 🙂
 
I've got it all set up properly there too. The iPad version is perfect, I just can't get the iPhone to go upside down 😕
 
I've got it all set up properly there too. The iPad version is perfect, I just can't get the iPhone to go upside down 😕

Post your updated shouldAutoRotate method, as well as the values in the UISupportedInterfaceOrientations entry in your app's info.plist.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.