Closed gorbat-o closed 3 years ago
There is a protocol named LNPopupPresentationDelegate
and a method called when the user taps on the popup bar to open the popup content view controller:
func popupPresentationControllerWillOpenPopup(_ popupPresentationController: UIViewController, animated: Bool) {
// ...
}
@gorbat-o Does that answer your question? LNPopupCustomBarViewController
is responsible for just the custom bar presentation, you should not be performing action in it related to the popup opening or closing. For listening to the popup state in general, as @iDevelopper said, LNPopupPresentationDelegate
exists that gives you updates.
That should do it! I will iterate with that! thank you for the quick reply!!
I am actually using the LNPopupCustomBarViewController
and it doesn't seem to have access to LNPopupPresentationDelegate
. Where do I acces to popupPresentationControllerWillOpenPopup
.
I have found the popupOpenGestureRecognizer
in LNPopupBar
but can't do much with that.
I just need to add an action for when the popup is clicked that is not related to the popup itself.
Did you look at the header documentation?
You set that property with the object you'd like to be the delegate. The property should be set on the popup presentation container controller (like your tab bar, etc.).
If you'd like to have your custom bar controller as the delegate, set it. I don't think it's a good decision, but it's up to you.
If you just need to respond to taps on the bar, you can add your own gesture recognizer that can recognize simultaneously with the system gesture recognizer. That I think is a better option in your case.
Ok yep sounds good! I thought there might be a way to use the one included! Thanks Leo and merci Patrick for your help!
When I add my own tap gesture it seems to block the one from the library.
I added the gesture in the viewDidLoad of my subclass of LNPopupCustomBarViewController
.
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.popupBarTapped(_:)))
container.addGestureRecognizer(tapGesture)
You need to learn how to use gesture recognizer.
I thought I knew! 😁 Will definitely read more documentation about it Thanks for your time
Thanks for the poke!
For those who will be interested.
I was able to make it work by implementing func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool
function from UIGestureRecognizerDelegate
.
@gorbat-o,
Amazing library!
I am not sure to understand how to add an action when you click on a custom
LNPopupCustomBarViewController
. Is there a delegate or notification i can subscribe to know when the user click on thepopupController
?