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

Sweetooth44

macrumors newbie
Original poster
Sep 18, 2012
8
0
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.
 
I've got everything working fine except on the iPhone it refuses to rotate 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 :confused:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.