iOS动画切换window的根控制器

options是动画选项

[UIView transitionWithView:[UIApplication sharedApplication] duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
        BOOL oldState = [UIView areAnimationsEnabled];
        [UIView setAnimationsEnabled:NO];
        [UIApplication sharedApplication].keyWindow.rootViewController = [RootViewController new];
        [UIView setAnimationsEnabled:oldState];
    } completion:^(BOOL finished) {
        
    }];

你可能感兴趣的:(iOS动画切换window的根控制器)