RootViewController animation transition, initial orientation is wrong

I looked into this just now because I kept getting the same issue. I randomly tried the following, and it worked perfectly:

[UIView
    transitionWithView:window 
    duration:0.5
    options:UIViewAnimationOptionTransitionCrossDissolve
    animations:^(void) {
        BOOL oldState = [UIView areAnimationsEnabled];
        [UIView setAnimationsEnabled:NO];
        [(ICApp *)sharedApplication.delegate window].rootViewController = self;
        [UIView setAnimationsEnabled:oldState];
    } 
    completion:nil];

I know it’s a bit odd to disable/enable animations inside an animation block, but the cross dissolve animates, and the rotation does not — the view controller appears already rotated and ready to roll.

Leave a Comment