美文网首页
iOS--修改present方向

iOS--修改present方向

作者: 请叫我大帅666 | 来源:发表于2019-08-19 19:38 被阅读0次

下列类似push效果

当前控制器:

// 修改present 方向
CATransition *transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = UIViewAnimationCurveEaseInOut;
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.view.window.layer addAnimation:transition forKey:nil];
注意: window 不能去掉
[self presentViewController:vc animated:NO completion:nil];

目标控制器:

// 修改present 方向 (此效果跟**push效果一样)
CATransition *transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = UIViewAnimationCurveEaseInOut;
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[self.view.window.layer addAnimation:transition forKey:nil];
[self dismissViewControllerAnimated:NO completion:nil];

相关文章

网友评论

      本文标题:iOS--修改present方向

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