Question

I have a very old app that's compatible with iOS 3.2+ devices (both iPads and iPhones). And I have a big issue making it compatible with iOS 7!

In fact, it has been written long ago before ARC, storyboards and all that syntactic sugar we are pleased to play with nowadays. And I'm having a very hard time trying understanding some interface orientation issue:

For the iPhone, the app is only visible in landscape... No problemo with the main ViewController. But the settings one (a simple ViewController with a UITableView in it) is always displayed in Portrait !!! Whatever the properties I set and the methods I write.

In the .plist I have only supported orientations LandscapeLeft and Right. In the Settings View Controller, I have those methods:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return UIInterfaceOrientationIsLandscape(interfaceOrientation) || (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone);
}

- (BOOL) shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)?UIInterfaceOrientationMaskLandscape:UIInterfaceOrientationMaskAll;
}

But what really bothers me is that when I display self.interfaceOrientation it says Landscape (in the viewWillAppear, viewDidAppear and viewWillLayoutSubviews).

But the most weird, is that the status bar is in Landscape, over the Portrait ViewController!!!

(Of course, the problem appears both on device and simulator)

So if someone can help putting back that ViewController all in Landscape. Thanks in advance!

Was it helpful?

Solution

Well at last, I eventually found it!!!

The problem was (I still don't know exactly why) caused by the way I was switching between ViewControllers (the old iOS 3 way).

So to correct if, I test if the method presentViewController:animated:completion is available (God bless respondsToSelector:) and I use it when I can.

Problem solved!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top