UISwipeGestureRecognizerDirectionRight NO funciona dentro de DetailViewController.m con iOS 5.1

this is my first question, but i use this site a lot this last months (thanks for all).

My problem: i have a split-view project for i-Pad. In the DetailViewController I use a UIButton. Here's some code from DetailViewController.h:

@property (strong, nonatomic) IBOutlet UIButton *button;
- (void)swipeRightDetected:(UISwipeGestureRecognizer *)recognizer;

In DetailViewController.m Yo solo hago esto:

- (void)viewDidLoad
    [super viewDidLoad];
    [self configureView];

    UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeRightDetected:)];
    swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
    [self.button addGestureRecognizer:swipeRight];

- (void)swipeRightDetected:(UISwipeGestureRecognizer *)recognizer

    if (recognizer.view == self.button) {

Now the problem is: it was working perfectly with iOS 5.0.1 and previous. Now it doesn't work any longer. IT WORKS FOR ANY OTHER DIRECTION but NOT for RIGHT direction and only in a DetailViewController!! It only works if you hit the iPad with strength and speed (like a slap!), and same thing for the simulator.. it only works if you do the swipe very very very fast!

I think it's a bug.. what should i do? Maybe post the same question on apple forum? Thank you all, you're all great!! Marco

preguntado el 09 de marzo de 12 a las 16:03

Are you linking this in Interface? -

yes.. it is linked properly... it works 1 time every 5/6 times...!! in any other direction it works good as always! -

2 Respuestas

I would guess that this has to do with the new "sliding presentation style" of the split view controller in iOS 5.1. The notas de la versión say that you can disable this behavior by setting presentsWithGesture a NO.

Another option might be to implement gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: in your gesture recognizer's delegate.

respondido 09 mar '12, 17:03

thx thx thx!! I didn't got what they mean in the release notes!! Now i got it!! thx again!! - marco.marinangeli

Thanks for this, I was pulling my hair out! - Chris

I'm blatantly copying this answer from a fantastic tip on this StackOverflow page: Aplicación de mesa maestra

En su AppDelegate.m file, add this line at the end of your "didFinishLaunchingWithOptions" function:

splitViewController.presentsWithGesture = false;

Suddenly, right-swiping works again on Master-Detail pages.

(Relieved sigh.)

contestado el 23 de mayo de 17 a las 12:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.