美文网首页IOS
自定义NavigationController push 页面的

自定义NavigationController push 页面的

作者: 如水的云如云的水 | 来源:发表于2018-03-04 14:27 被阅读71次

    //MARK: Push动画

    ///从下向上推出(push出页面 ----> 从底部到顶部 垂直出现-消失)

    funcsetPushAnimatedWithTransition(customSelf:UINavigationController) {

        if #available(iOS 9.0, *) {  }

        letanimation =CATransition.init()

         animation.duration=0.3

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

        animation.type = kCATransitionMoveIn//kCATransitionPush

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

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

    }

    ///从上向下推出(push出页面 ---> 从顶部到底部 垂直出现-消失)

    funcsetPopAnimatedWithTransition(customSelf:UINavigationController) {

       if #available(iOS 9.0, *) {}

        letanimation =CATransition.init()

        animation.duration=0.3

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

        animation.type = kCATransitionReveal//kCATransitionPush

        animation.subtype = kCATransitionFromBottom

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

    }

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

    //setPushAnimatedWithTransition(customSelf: self.navigationController!)

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

    相关文章

      网友评论

        本文标题:自定义NavigationController push 页面的

        本文链接:https://www.haomeiwen.com/subject/wqkdzttx.html