Hi,
I have an app with 3 views each having a view controller. I would like to navigate through the view using swipes but I cannot get it work. I think something is wrong with assigning the same UISwipeGestureRecognizer to all of my views.
In my app delegate, I create the 3 controllers:
Then I create the recognizer which monitors swipes from right to left :
Then I assign it to all of my views:
at this point the "handleSwipeFrom" is not called at all. If I assign the same recognizer only to one view (the 1st one), it is called and works fine.
What am I doing wrong ?
thanks,
Tex
I have an app with 3 views each having a view controller. I would like to navigate through the view using swipes but I cannot get it work. I think something is wrong with assigning the same UISwipeGestureRecognizer to all of my views.
In my app delegate, I create the 3 controllers:
Code:
ViewControllerA *vcA = [[ViewControllerA alloc] initWithNibName:....];
ViewControllerA *vcB = [[ViewControllerB alloc] initWithNibName:....];
ViewControllerA *vcC = [[ViewControllerC alloc] initWithNibName:....];
Then I create the recognizer which monitors swipes from right to left :
Code:
UISwipeGestureRecognizer * recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
recognizer.direction = UISwipeGestureRecognizerDirectionLeft;
Then I assign it to all of my views:
Code:
[vcA.view addGestureRecognizer:recognizer];
[vcB.view addGestureRecognizer:recognizer];
[vcC.view addGestureRecognizer:recognizer];
at this point the "handleSwipeFrom" is not called at all. If I assign the same recognizer only to one view (the 1st one), it is called and works fine.
What am I doing wrong ?
thanks,
Tex
Last edited: