iOS--修改present方向

2019-08-19  本文已影响0人  请叫我大帅666

下列类似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];
上一篇 下一篇

猜你喜欢

热点阅读