7
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated

This function load a view from right side. How can I Load a view from left side?

Harikrishnan
  • 9,688
  • 11
  • 84
  • 127
  • Try this link http://stackoverflow.com/questions/1096092/iphone-pushing-view-controller-in-a-left-direction/1096115#1096115 – DD_ Dec 06 '12 at 06:38
  • for your kind attention, actually you are trying to push a new view controller, not a UIView. – DD_ Dec 06 '12 at 06:40
  • its ok dude, but, the fact is, if you are trying to add a new UIView you can do it easily using UIView with Animation, but if you are navigating to a New UIViewController you cannot do it in the below suggested ways – DD_ Dec 06 '12 at 07:23

3 Answers3

7

Here it is

CATransition *animation = [CATransition animation];
[[self navigationController] pushViewController:elementController animated:NO];
[animation setDuration:0.45];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[[elementController.view layer] addAnimation:animation forKey:@"SwitchToView1"];

For this you have to #import <QuartzCore/QuartzCore.h>

Inder Kumar Rathore
  • 39,458
  • 17
  • 135
  • 184
3

don't think there is a readymade way to do that. You will have to animate the view yourself using animateWithDuration:delay:options:animations:completion: or animateWithDuration:animations:completion: (or any other animation methods) and change frames of your view accordingly so that it animates from the right side. Hope this helps :)

DD_
  • 7,230
  • 11
  • 38
  • 59
Divya
  • 818
  • 8
  • 10
1

if you already been pushed to a viewController you can use this:

[self.navigationController popViewControllerAnimated:YES]
Mutawe
  • 6,464
  • 3
  • 47
  • 90