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.