UINavigationController 自定义后退按钮上的过渡动画
我在 UINavigationController 中做了一个自定义转换,我使用的代码:
SecondView *newView = [[SecondView alloc] initWithNibName:nil bundle:nil];
[UIView beginAnimtaions:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown];
[self.navigationcontroller pushViewController:newView animated:NO];
[UIView commitAntimations];
[newView release];
但是该转换动画仅适用于前进,我可以将其应用到后退吗?
谢谢
I made a custom transition in UINavigationController, code I used:
SecondView *newView = [[SecondView alloc] initWithNibName:nil bundle:nil];
[UIView beginAnimtaions:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown];
[self.navigationcontroller pushViewController:newView animated:NO];
[UIView commitAntimations];
[newView release];
But that transition animation applies only on Forward, can I apply it on Back?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,只需为后退按钮定义一个自定义 UIBarButtonItem 并将其链接到一个自定义方法,该方法执行与推送控制器类似的操作,但您需要弹出视图控制器,而不是推送。
即首先创建后退按钮(在 init 或 viewDidLoad 方法中)
,然后在后退方法中,您可以执行自定义动画
Of course, simply define a custom UIBarButtonItem for back button and link it to a custom method that do something similar you do to push the controller, but instead of pushing you'll need to pop the view controller.
i.e. first you create your back button (in init or viewDidLoad method)
then, in your back method, you can do your custom animation