RootViewController 切换过渡动画 [英] RootViewController Switch Transition Animation

查看:30
本文介绍了RootViewController 切换过渡动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 appDelegate 中用新的视图控制器替换现有的视图控制器作为 rootviewcontroller 时,有什么方法可以实现过渡/动画效果?

Is there any way to have a Transition/animation effect while replacing an existing viewcontroller as rootviewcontroller with a new one in the appDelegate?

推荐答案

可以将rootViewController的切换包裹在一个过渡动画块中:

You can wrap the switching of the rootViewController in a transition animation block:

[UIView transitionWithView:self.window
                  duration:0.5
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                animations:^{ self.window.rootViewController = newViewController; }
                completion:nil];

这篇关于RootViewController 切换过渡动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆