使用UINavigationController从右向左推送ViewController [英] Push ViewController from Right To Left with UINavigationController
本文介绍了使用UINavigationController从右向左推送ViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
众所周知UINavigationController从左到右推送ViewController,有没有办法将视图从右推到左?喜欢后退按钮的动画。
现在我有这个:
As everyone know the UINavigationController push a ViewController from Left To Right, is there a way to push the View from Right To Left? like the animation for the back button.
For now I have this:
[self.navigationController pushViewController:viewController animated:YES];
推荐答案
您可以创建 NSMutableArray
来自navigationController的 viewcontrollers
数组,并在当前版本之前插入新的viewController。然后设置viewControllers数组没有动画并弹回。
You can create a NSMutableArray
from the navigationController's array of viewcontrollers
and insert new viewController before the current one. Then set the viewControllers array without animation and pop back.
UIViewController *newVC = ...;
NSMutableArray *vcs = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
[vcs insertObject:newVC atIndex:[vcs count]-1];
[self.navigationController setViewControllers:vcs animated:NO];
[self.navigationController popViewControllerAnimated:YES];
这篇关于使用UINavigationController从右向左推送ViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文