ios – 如何设置动画以弹出推送的UIViewController

前端之家收集整理的这篇文章主要介绍了ios – 如何设置动画以弹出推送的UIViewController前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_3@
我有一个小问题.我有一个pushviewcontroller,它使用动画.
我的代码是这样的:

[UIView  beginAnimations: @"Showinfo"context: nil];
   [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
   [UIView setAnimationDuration:0.75];
   [self.navigationController pushViewController:dtv  animated:YES];
   [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
   [UIView commitAnimations];`

它工作得很好,但是当推送视图并且我返回时,这不会动画.
我回去的时候不知道怎么做同样的动画.
谁能帮我?谢谢!

解决方法

这就是我一直设法完成这项任务的方式.

推送:

[UIView  beginAnimations: @"Showinfo"context: nil];
   [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
   [UIView setAnimationDuration:0.75];
   [self.navigationController pushViewController:dtv  animated:YES];
   [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
   [UIView commitAnimations];`

对于Pop:

[

UIView  beginAnimations: @"Showinfo"context: nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.375];
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];

我仍然从中获得了很多反馈,因此我将继续更新它以使用动画块,这是Apple建议的动画方式无论如何.

推送:

MainView *nextView = [[MainView alloc] init];
[UIView animateWithDuration:0.75
                         animations:^{
                             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                             [super pushViewController:nextView animated:NO];
                             [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
                         }];

对于Pop:

[UIView animateWithDuration:0.75
                         animations:^{
                             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                             [UIView setAnimationTransition:transition forView:self.navigationController.view cache:NO];
                         }];
[self.navigationController popViewControllerAnimated:NO];
@H_404_3@

猜你在找的Xcode相关文章