Lnpopupcontroller: gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: doesn't do much

Created on 22 Sep 2017  路  16Comments  路  Source: LeoNatan/LNPopupController

Hopefully I'm not too annoying at this point, but after playing around I've noticed that gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool doesn't do much.

Description

gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool DOES get called but doesn't influence on whether dismiss gesture recognizer should recognize a pan. I've tried returning false and true but it doesn't affect anything at all.

bug needs investigation

All 16 comments

The implementation forwards delegate calls directly. So I suspect this is a gesture recognizer logic bug on your end. Let鈥檚 see.

You may also need to implement gestureRecognizer:shouldRequireFailureOfGestureRecognizer:

Ohh, wait. Now that I think about it, could be another issue as well. I am also listening directly to other gesture recognizers, such as the scroll view delegates. I will set this as a bug and investigate.

I will investigate, whether gestureRecognizer:shouldRequireFailureOfGestureRecognizer: solves the issue.

I don鈥檛 think it will now. I might need to add some code for it to work.

I'm facing the same problem myself.

I have a horizontal carousel inside the popupContentView and I want that horizontal scrolling does not affect the state of the popContentView, of course.

On iOS9 it closes very frequently, even without Y movement (checked attaching a delegate to popupContentView.popupInteractionGestureRecognizer).
It seems to work better on iOS11. I need to drag vertically way more for closing it.

Fixed. Please use shouldRequireFailureOfGestureRecognizer: or shouldRecognizeSimultaneouslyWith: to exclude the critical views.

I'm returning false in shouldRequireFailureOfGestureRecognizer, shouldBeRequiredToFailByGestureRecognizer and shouldRecognizeSimultaneouslyWith, yet I can still drag to dismiss the popup. Methods are getting called and I set the delegate here: popupContentView.popupInteractionGestureRecognizer.delegate = self. To be clear, I'm returning false only to check, if I can disable the popupInteractionGestureRecognizer. I will implement the code to exclude all critical views later. Am I doing anything wrong here?

What I did was take the example project and change the popup content controller to UITableViewController.
Then implemented shouldRecognizeSimultaneouslyWith and returned NO if the gr鈥檚 view is kind of scroll view.

It worked as expected for me.

Are you sure you are using the latest framework? Do you mind helping me debug? Can you breakpoint here: https://github.com/LeoNatan/LNPopupController/blob/9ff60456f8c1395a52ce30f5948aae105eace03c/LNPopupController/LNPopupController/Private/LNPopupController.m#L563 and see what鈥檚 going on?

I've found out something: all UIScrollViews are unscrollable while UIDatePicker is. In both cases I can still dismiss the popup. Also, the line 563 never got called, so setting a breakpoint there didn't do anything.

Hm, so the point of failure is somewhere else. Can you please provide a demo project where the issue reproduces?

Here you go: demo project

Note: I've implemented a delay option into the presentPopup method for my app.

Ping

Oops, sorry. I am looking into LNPopupController issues and will look into this as well.

Two remarks. I pushed a small update that includes an improvement for your use case. Also, in gestureRecognizer(_, shouldRequireFailureOf:), you should return true to disable scrollviews from dismissing the popup.

Great. I鈥檒l take a look asap. Thanks!

Works great, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnswifttt picture johnswifttt  路  5Comments

RajChanchal picture RajChanchal  路  5Comments

johnswifttt picture johnswifttt  路  5Comments

iKushalManiyar picture iKushalManiyar  路  4Comments

yetdog picture yetdog  路  8Comments