maxkonovalov / MKDropdownMenu

🔻 Dropdown Menu for iOS with many customizable parameters to suit any needs
MIT License
524 stars 83 forks source link

How to dismiss menu when no select an item? #29

Closed polymorphia closed 7 years ago

polymorphia commented 7 years ago

Is there a way to dismiss the menu displayed, if the user didn't select an element of the dropdown menu? I'm observing that the view displayed like a blur responds to the tap and dismiss. But what happens when the tab is outside of this blur view? If i navigate to other view controller (with the dropdown displayed) my menu is moving with that new View Controller pushed.

what i'm doing wrong? Thanks for your help, and congrats for your work.

maxkonovalov commented 7 years ago

Hello @polymorphia, You can dismiss the dropdown manually by calling [dropdownMenu closeAllComponentsAnimated:YES], e.g. in -viewWillDisappear:. Also, the dropdown is presented on the current window by default. If you provide a presentingView (your view controller's view for example), the dropdown will be added to that view, so it will move from screen together with dismissing view. Hope this helps!

polymorphia commented 7 years ago

OK Max, this worked for me. Now my view dismiss in viewWillDissapear. I think that will be very helpful if the menu dismiss on tap in the Dim background around all the view and not only in the part bellow the drop down menu. But it's just a suggestion i think.

Thanks for your useful help and prompt response. Greetings!

maxkonovalov commented 7 years ago

Actually the menu does dismiss when the dimmed background view is tapped, just note that the dimmed part is only below the menu's header.