Post this code in view controller in viewDidLoad..
UISwipeGestureRecognizer *swipeLeft =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeLeft:)];
swipeLeft.direction =UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeLeft];
UISwipeGestureRecognizer *swipeRight =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeRight:)];
swipeRight.direction =UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeRight];
Put methods for swipeLeft: and swipeRight:
Hope this will help you..
Code for swipeLeft: and swipeRight:
-(IBAction)swipeLeft:(id)sender
{
CView *view =[[CView alloc]initWithNibName:@"CView" bundle:Nil];
CATransition *animation = [CATransition animation];
[self.navigationController pushViewController:view animated:NO];
[animation setDuration:0.30];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[[view.view layer] addAnimation:animation forKey:@"CView"];
}
-(IBAction)swipeRight:(id)sender
{
EView *view =[[EView alloc]initWithNibName:@"EView" bundle:Nil];
view.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.navigationController pushViewController:view animated:YES];;
[view release];
}
Hope this will help you..