Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push ViewController from Right To Left with UINavigationController

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]; 
like image 638
ludo Avatar asked Mar 10 '10 09:03

ludo


People also ask

What is pushviewcontroller?

Pushing a view controller causes its view to be embedded in the navigation interface. If the animated parameter is true , the view is animated into position; otherwise, the view is simply displayed in its final location.


1 Answers

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]; 
like image 128
Felix Lamouroux Avatar answered Oct 12 '22 21:10

Felix Lamouroux