众所周知 UINavigationController 从左到右推送 ViewController,有没有办法从右到左推送 View?就像后退按钮的动画一样.
现在我有这个:
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];
您可以从 navigationController 的 viewcontrollers
数组创建一个 NSMutableArray
并在当前 viewController 之前插入新的 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!