[英]Change root view controller using HERO transition
I have this code....我有这个代码....
UIView.transition(with: window!, duration: 0.3, options: **animation**, animations: {
window!.rootViewController = rootVC
}, completion: nil
Is it possible put Hero transition replacing "animation" var?是否可以将英雄过渡替换为“动画”变量?
As an example:举个例子:
let current = window.rootViewController!
let transition = HeroTransition()
// Collapse vertically in dismissal, over 1 second.
current.view.hero.modifiers = [.scale(x: 1, y: 0.1, z: 1), .duration(1), .fade]
// Rotate in, over 2 seconds.
replacement.view.hero.modifiers = [.rotate(z:1.6), .duration(2), .fade]
transition.transition(from: current, to: replacement, in: window) { (finished) in
window.rootViewController = replacement
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.