Note that there are some explanatory texts on larger screens.

plurals
  1. POrootViewController set but comes up as incorrect orientation
    primarykey
    data
    text
    <p>My situation is very similar to <a href="https://stackoverflow.com/questions/6532894/orientation-problem-when-i-set-a-rootviewcontroller">this question</a> . I have an app that is universal where iPhone is in portrait orientation and the iPad is in Landscape and I switch between all of my main screens using the appDelegate.window.rootViewController = newScreen; The iPhone app works perfectly. The iPad app will sometime throw the screen up in portrait orientation instead of landscape. Here is some sample transition code:</p> <pre><code>AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; ViewController* v = nil; if (IS_IPAD()) { v = [[ViewController alloc] initWithNibName:@"ViewController-iPad" bundle:nil]; }else{ v = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; } [appDelegate.window setRootViewController:(UIViewController*)v]; </code></pre> <p>I also tried this from <a href="https://stackoverflow.com/questions/8053832/rootviewcontroller-animation-transition-initial-orientation-is-wrong">this other question</a> :</p> <pre><code>AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; ViewController* v = nil; if (IS_IPAD()) { v = [[ViewController alloc] initWithNibName:@"ViewController-iPad" bundle:nil]; }else{ v = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; } [UIView transitionWithView:appDelegate.window duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^(void) { BOOL oldState = [UIView areAnimationsEnabled]; [UIView setAnimationsEnabled:NO]; [appDelegate.window setRootViewController:(UIViewController*)v]; [UIView setAnimationsEnabled:oldState]; } completion:nil]; </code></pre> <p>But nothing has fixed it. </p> <p>Also tried using [appDelegate.window makeKeyAndVisable] and [appDelegate.window makeKeyWindow] in the hopes that this would "shock" it into doing the correct orientation.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload