present(模态)实现出push的效果

在present加上这个转场动画,取消掉原来的转场动画

  CATransition *animation = [CATransitionanimation];

    animation.duration = 0.35;

    animation.timingFunction = UIViewAnimationCurveEaseInOut;

    animation.type = kCATransitionPush;

  animation.subtype = kCATransitionFromRight;

    [self.view.window.layeraddAnimation:animation forKey:nil];

    [self presentViewController:setVC animated:NOcompletion:nil];

在dissmiss加上这个转场动画,取消掉原来的动画效果

      CATransition *animation = [CATransition animation];

 animation.duration = 0.35;

 animation.timingFunction = UIViewAnimationCurveEaseInOut;

 animation.type = kCATransitionPush;

 animation.subtype = kCATransitionFromLeft;

   [self.view.window.layer addAnimation:animation forKey:nil];

       [selfdismissViewControllerAnimated:NOcompletion:nil];

然后就和NavCtl的push效果和back效果几乎一致。

posted @ 2017-10-17 09:17  菜鸟好笨笨!  阅读(1345)  评论(0编辑  收藏  举报