与 ViewController 的 present 转场动画不同
1, 导航控制器,pushViewController 的转场动画,的代理是
navigationController?.delegate = self
2, 指定动画的方法
extension Two: UINavigationControllerDelegate{
func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if operation == .push{
return navAnimatorPush
}
else{
return nil
}
}
}
具体的动画设置也不同
使用 snapshotView , 会出现奇怪的效果
代码很好理解
class NavBaseCustomAnimatorPush: NSObject, UIViewControllerAnimatedTransitioning{
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {

本文探讨了导航控制器中pushViewController与ViewController的present转场动画的区别,并详细讲解了pushViewController的动画设置,包括可能出现的异常效果及解决方案。同时提供了相关的代码示例和github资源链接。
最低0.47元/天 解锁文章
1123

被折叠的 条评论
为什么被折叠?



