0

My app was originally created for iPad, in Landscape orientation. Now I've to make it compatible with iPhone.

Converting Storyboard from iPhone to iPad I followed this thread to copy my storyboard and define it for iPhone. In the project settings, I defined the new story board for iPhone, in Portrait mode. In the new storyboard, I changed every viewController to set in Portrait mode.

When I launch the App on iPhone (simulator or device) It's still in landscape mode but with the changes (moved fields, for exemple) I made in the new storyboard.

Did I forget something? Thanks :)

enter image description here

Community
  • 1
  • 1
Verdant
  • 288
  • 1
  • 10

2 Answers2

0

This started happening with the new xCode for universal projects... go to your .plist file for the project and you will find a field for orientation for iPad (1 item) and orientation for iPhone (4 items), expand the iphone one and remove the rows containing orientation you don't want. Save, clean, and build.

Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
0

Don't search anymore, i found the solution. In the app I've to access to the Camera Roll. On the iPad, if I access it in landscape mode, the Camera Roll opens in Portrait, and it's ugly and annoying for the user. Then someone on Stack suggested to use a Category UIViewController+OrientationFix.h

Here is the code...

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {


    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

- (BOOL)shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskLandscape;
}

I had to modify it

NSString *deviceType = [UIDevice currentDevice].model;
        NSLog(@"Device Type : %@", deviceType);
        if([deviceType hasPrefix:@"iPad"])
        {
            return UIInterfaceOrientationMaskLandscape;
        }
        else
            return UIInterfaceOrientationMaskAll;

The strange thing it that I didn't found it by searching "landscape" in all the projet, even by ignoring case.

Verdant
  • 288
  • 1
  • 10