1

I am making iOS SDK which will be used to add functionalities to client's app. My SDK will be presenting views modally over the top current view of the client's app. I am using below snippet to present view modally

sdkViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[currentAppViewController presentViewController:sdkViewController animated:YES completion:nil];

Here, I want to Fix the orientation of my sdkViewController(and subviews) to Portrait mode
I have tried to implement this

Inside sdkViewController.m

- (BOOL)shouldAutorotate {
    return NO;
}

-(UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
     return UIInterfaceOrientationPortrait;
}

But no success. After going through disable autorotate on a single UIViewController in iOS6, and similar posts, almost all insisted to subclass the UINavigationController and override the shouldAutorotate and supportedInterfaceOrientations in the subclass.

I have No Navigation controller before first ViewController, I just present my sdkViewController modally over the top most view of the client's app.

After hours of googling, i was convienced that the the three methods i have try to implement in sdkViewController.m, are useless because this methods are called inside rootViewController, not inside any childViewController.

Please help me find a way to fix the orientation of views persented modally over the view where i have no juridiction.

Community
  • 1
  • 1
Om Patel
  • 151
  • 1
  • 7
  • Have you tried accessing the parent using .presentingViewController property? Modifying that viewcontroller's autorotate properties, or a callback method? – Brooks Hanes Nov 25 '15 at 15:49
  • I should not modify parent view controller. As it would have client's preferences. – Om Patel Nov 26 '15 at 05:10
  • Any tab bar controller, navigation controller or container keep `sdkViewController` ? – Proton Jun 27 '16 at 08:02

0 Answers0