Question

According to apple my application has to be able to run in both portrait modes. How do I accomplish this with shouldAutorotateToInterfaceOrientation??

Was it helpful?

Solution

Just return YES no matter what the interface orientation is. This will allow the system autorotate to the upside-down orientation.

If you don't want to support the landscape orientations, then return:

return UIInterfaceOrientationIsPortrait(interfaceOrientation);

OTHER TIPS

This code allows any orientation except landscape:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
    return (orientation != UIDeviceOrientationLandscapeLeft) &&
           (orientation != UIDeviceOrientationLandscapeRight);
}

Submitted app was rejected for the above reason. App used only portrait(Home Button Down) orientation.

" app does not comply with the Apple iOS Human Interface Guidelines, as required by the App Store Review Guidelines.

Specifically, app only supported the bottom-up variant of the portrait orientation, but not the top-up variant.

While supporting both variants of both orientations, each with unique launch images, provides the best user experience and is recommended, we understand there are certain applications that must run in the portrait orientation only. In this case, it would be appropriate to support both variants of that orientation in your application, e.g., Home button up and down."

To solve. 1)

 `- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

2) Open info.plist add a new string UILaunchImageFile & insert value as Default-Portrait.png

3) Change Default.png to Default-Portrait.png & Duplicate the file to rename Default-PortraitUpsideDown.png(Rotate this one with 180 degree)

This enables up & down portrait with respective launch images.

make sure you use UIInterfaceOrientationIsPortrait(interfaceOrientation) in all view-controllers inside the app, if required so . also do a clean before run.

Use this.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top