Pregunta

Esta es mi primera pregunta, pero uso este sitio mucho este último mes (gracias por todos).

Mi problema: Tengo un proyecto de vista dividida para i-Pad.En elController de detalle uso un UTBITTON. Aquí hay algún código de DetailViewController.h:

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

en DetailViewController.m 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) {
    NSLog(@"YEAH");
    }
}

Ahora el problema es: funcionaba perfectamente con iOS 5.0.1 y Anterior.Ahora ya no funciona más.¡Funciona para cualquier otra dirección pero no para la dirección correcta y solo en un detalleviewcontroller! ¡Solo funciona si golpea el iPad con fuerza y velocidad (como una bofetada!), Y lo mismo para el simulador ... solo funciona si haces el golpe muy muy rápido!

creo que es un error ... ¿qué debo hacer?Tal vez publicar la misma pregunta en el Foro de Apple? ¡Gracias a todos, todo eres genial !! Marco

¿Fue útil?

Solución

I would guess that this has to do with the new "sliding presentation style" of the split view controller in iOS 5.1. The release notes say that you can disable this behavior by setting presentsWithGesture to NO.

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

Otros consejos

I'm blatantly copying this answer from a fantastic tip on this StackOverflow page: Master Table Application

In your 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.)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top