push出页面和present一样底部垂直出现(从下向上推出)



///从下向上推出(push出页面和present一样底部垂直出现)

func setPushAnimatedWithTransition(customSelf: UINavigationController) {

    

    if #available(iOS 9.0, *) {

        

    }

    

    let animation = CATransition.init()

    

    animation.duration = 0.3

    

    animation.timingFunction = CAMediaTimingFunction.init(name: kCAMediaTimingFunctionLinear)

    

    animation.type = kCATransitionPush

    

    animation.subtype = kCATransitionFromTop//kCATransitionFromTop控制类型

    

    customSelf.view.layer.add(animation, forKey: nil)

    

}


//使用示例--->那个页面去push想要此效果,push前调用此方法

setPushAnimatedWithTransition(customSelf: self.navigationController!)

self.navigationController?.pushViewController(SelectLogController(), animated: false)//此处animated必须false


猜你喜欢

转载自blog.csdn.net/flyingfirefish/article/details/80414721