I want to change view controllers by swiping controller like i when i swipe the message box should swipe from ViewController1->ViewController2 and from viewController1<-viewController2 i know i have to use UISwipeGestureRecognizer
or may be UIScrollView
or UIPageController
with contents of ViewControllers not Views. like default messageViewController swipe to EmailViewController or EmailViewController to MessageViewController. is there any idea how to do like this?
- (void)goToNext{
//your code to load youn next view controller
}
- (void)goToBack{
//your code to load your previous view controller
}
- (void)viewDidLoad{
[super viewDidLoad];
UISwipeGestureRecognizer *recognizer;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(goToNext)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[[self view] addGestureRecognizer:recognizer];
[recognizer release];
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(goToBack)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)];
[[self view] addGestureRecognizer:recognizer];
[recognizer release];
}