0

I have an iOs project that needs to support all orientations on iPad and on iPhone I need to support only portrait on all view controllers EXCEPT one that needs to support all orientations and autorotate.

I tried:

#pragma mark - Should Rotate device
- (NSUInteger)supportedInterfaceOrientations
{
    if ([[DeviceInfo sharedInstance] is_iPhone]) {
        return UIInterfaceOrientationMaskPortrait;
    } else {
        return UIInterfaceOrientationMaskAll;
    }
}

But that method doesn't get called... How should I do this?

user1028028
  • 6,323
  • 9
  • 34
  • 59

3 Answers3

1

If my understanding is right then I have given answer for this query so u could follow this link.

Do let me know if any doubt.

Okay so got solution for your iOS 7 as below method write down in appDelegate class.

- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {

  if ([[[[[[UIApplication sharedApplication] keyWindow] rootViewController] childViewControllers] lastObject] isKindOfClass:[ViewController class]])   //Here you could provide your view controller and provide orientation which u want for that particular view controller.
  {
    return UIInterfaceOrientationMaskPortrait;
  }
  else
  {
    return UIInterfaceOrientationMaskLandscape;
  }
}

This will help you out for iOS 7.

Community
  • 1
  • 1
nikhil84
  • 3,235
  • 4
  • 22
  • 43
1

Why don't you select the wanted ones here:

enter image description here

Select your app in project navigator -> general -> select your target -> scroll down to deployment info.

gran33
  • 12,421
  • 9
  • 48
  • 76
0

The problem was solved by implementing the methods on the navigation controller that owns all the views

user1028028
  • 6,323
  • 9
  • 34
  • 59