Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Tex-Twil

macrumors 68030
Original poster
May 28, 2008
2,501
15
Berlin
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:

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:
I think assigning the same UISwipeGestureRecognizer object to all three view.

Try creating 3 UISwipeGestureRecognizer objects and assign one to each of the views.
ok I will try that.

Btw, what I'm trying to achieve is to have a UINavigationController without the navigation bar and navigate through the views using swipes. Is this ok to have such a UI or am I doing something not conform to the guidelines ?

cheers
 
I do it too, with for example an UISegment at the top. Where u can click, and it will create a new controller stack on each segment. And u can swipe through the segments (other controllers).
I just recreate them in each. or u could make a delegate, and make it conform to it.
 
Is this application going to be published on the store?

What happens when you turn on VoiceOver? How do blind users interact with your application when swipes are disabled (or reimplimented by the Apple VoiceOver API)?
 
I think assigning the same UISwipeGestureRecognizer object to all three view.

Try creating 3 UISwipeGestureRecognizer objects and assign one to each of the views.
ok that worked.

Is this application going to be published on the store?
yes

What happens when you turn on VoiceOver ? How do blind users interact with your application when swipes are disabled (or reimplimented by the Apple VoiceOver API)?
I'm not sure to understand.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.