ios – 如何设置动画以弹出推送的UIViewController
发布时间:2020-12-14 17:39:44 所属栏目:百科 来源:网络整理
导读:我有一个小问题.我有一个pushviewcontroller,它使用动画. 我的代码是这样的: [UIView beginAnimations: @"Showinfo"context: nil]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.75]; [self.navigationCont
我有一个小问题.我有一个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]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |