iOS 6 UIGestures (Tap) stops working with QLPreviewController
Asked Answered
R

1

4

Currently I'm using a QLPreviewController in a navigation controller. (pushViewController)

To hide the navigationbar I use a UITapGestureRecognizer. The user can show/hide the navigation bar by a single touch (tap). This worked well in iOS5

- (void)viewWillAppear:(BOOL)animated {
   [super viewWillAppear:animated];

   UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
   [tapRecognizer setNumberOfTapsRequired:1];
   [tapRecognizer setDelegate:self];
   [[self view] addGestureRecognizer:tapRecognizer];
   [tapRecognizer release];
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

- (void)tapped:(UIGestureRecognizer*)gestureRecognizer
{
    //hide -/- show navigation bar
    [[self navigationController] setNavigationBarHidden:![[[self navigationController] navigationBar] isHidden] animated:YES];
}

But in the released version of iOS 6 the taps are now completely ignored, so I can't hide my navigation bar anymore.

Reason why I want to hide the navigation bar?

If you open a .numbers document, the navigationbar hides the 'sheet-buttons' under the navigation bar.

Ty.

Resurrectionism answered 1/10, 2012 at 14:35 Comment(2)
Were you ever able to find a solution to this? I am having the same problem.Dahlgren
Having the seme problem. Would be good to know if there is a solution to this.Psychrometer
P
7

since ios 6 the QLPreviewController is actually a completely seperate app (seperate process and everything)

Apple uses XPC for that:

=> so when you push that, your whole app moves to the bg, including its window and gesture recognizers

Parallelogram answered 11/11, 2012 at 15:17 Comment(6)
I'm curious to know if there's a solution or workaround thoughPrimine
It is not true that "your whole apps moves to the bg, including its window and gesture recognizers". It is more like any touch events happening over the QLPreviewController are never seen by any part of your app, not even UIWindow. Your app is still running and can receive touch events if they don't happen inside the QLPreviewController. You can, for example, put a view on top of the QLPreviewController, and it will receive touch events.Epithelium
the QLPreviewController is a fullscreen thingy. you push it or present it modally... QUOTE from the docs: " a modally-presented (that is, full-screen) controller"Parallelogram
bg = not into the BackgroundMode but behin the new UIWindow that the Remote VC usesParallelogram
please show a sample (ios6+) where this is not so ;)Parallelogram
Presenting a dialog modally does not create a new UIWindow. I'm not sure what your gesture recognizers moving to the bg means but if you put a view on top of the QLPreviewController and attach a gesture recognizer to it that gesture recognizer works. That view and your app continue to receive events. In addition, when you present something modally on an iPad it doesn't have to take up the full screen.Epithelium

© 2022 - 2024 — McMap. All rights reserved.