0

I have been trying to convert few old apps written in objC long ago in iOS4 which support multiple ViewController with different orientation.

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

Above Method is called in app delegate from ViewController and Desire Orientation was set but seems stopped working with iOS8.

I have tried number of solution like creating Category of UINavigation controller etc, but nothing seems working with iOS8.

What is best approach to handle Multiple Orientation for both iPhone and iPad.

Furthermore, I am not using Storyboard with size classes, in plist i am only supporting portrait orientation.

AiOsN
  • 2,305
  • 2
  • 23
  • 29
  • You need to show some code so that we can see what's the real issue. – Hemang Jun 19 '15 at 11:52
  • the best way is always the Apple's way, here is the [documentation about it](https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007457-CH1-SW1). – holex Jul 03 '15 at 11:42

2 Answers2

0

From iOS 6 onwards, you've to use.

- (BOOL)shouldAutorotate {

    UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

    if (orientation == UIInterfaceOrientationPortrait) {
        // your code for portrait mode
    }

    return YES;
}

Refer to shouldAutorotateToInterfaceOrientation not being called in iOS 6

Community
  • 1
  • 1
Ankit Sachan
  • 7,690
  • 16
  • 63
  • 98
0

Check all the orientation you want to support in device. For that go to Project target-> Deployment info -> Device orientation-> Tick mark the desired orientation.

Rajesh Maurya
  • 3,026
  • 4
  • 19
  • 37