Search code examples
iosuigesturerecognizerios6qlpreviewcontroller

iOS 6 UIGestures (Swipe) stops working with QLPreviewController


In iOS 6 beta 4 and iOS 5.1.1 I have had left/right swipes allowing users to swipe between different QLPreviewControllers, hosted in a UIViewController.

In the released version of iOS 6 the swipes are now completely ignored.

Attempted to put a UIView as a subview of the preview controller in an attempt to get the view hosting the preview controller to intercept the swipes before the preview controller has a chance to swallow them, but these are never triggered.

Any one seen this or know of a work around.

Thanks,


Solution

  • I had the same problem but with UITapGestureRecognizer not working on QLPreviewController. In iOS 6 that thing is like a black hole for UIGestureRecognizer objects...nothing makes it out of there!

    However I did find a workaround. I am subclassing QLPreviewController, so in my subclass I abused the (relatively) new viewWillLayoutSubviews method and added the following snippet:

    UIView *overlay = [[UIView alloc] initWithFrame:self.view.frame];
    overlay.backgroundColor = [UIColor whiteColor];
    overlay.alpha = .002f;
    for (UIView *v in self.view.subviews)
    {
        [v addSubview:overlay];
    }
    [overlay release];
    

    It may be overkill, but I basically went into the all of the quick look subviews and added a view to them that WOULD accept the gesture. I went with .002 alpha because making it lower would cause the gestures to be ignored again.