0

I want to only support landscape mode in my application. I have set the following:

  1. Orientation for all view controllers in the application are set to Landscape. Some of the view controllers are in a storyboard while couple are not
  2. The shouldAutorotateToInterfaceOrientation method for all viewControllers are set to return TRUE for LandscapeLeft and LandscapeRight orientations and FALSE otherwise
  3. Supported orientation in info.plist is set to landscape as well

Now when I run the application everything works as expected and the app starts in landscape model.

However under some conditions I have to throw a modal at the start of the application. I open the model from the rootviewcontroller of my UINavigationController with the following code:

    AskInfoViewController *askInfo = [[AskInfoViewController alloc] init];
    [askInfo setModalPresentationStyle:UIModalPresentationFormSheet];
    [askInfo setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [self presentModalViewController:askInfo animated:YES];

In these situations, the modal opens just fine but the background of the modal is in portrait mode.

Any idea how I can ensure that all views in my app are always in landscape model with or without the modal?

vishwa
  • 83
  • 6

1 Answers1

0

So I finally found out how to get it to work. Instead of opening the modal in the viewDidLoad method, I open it in viewDidAppear.

vishwa
  • 83
  • 6