Reputation: 112
In my app I've coded a side menu that looks like this:
Here's the code that is called when I tap a menu button that's in some views:
How can I have the menu slide in to view (depending on where the user's dragging finger is) and swipe away? And also go away when I tap the dimmed view on the right.
Any help is appreciated.
Upvotes: 0
Views: 1519
Reputation: 316
One way to achieve this is using the gesture recognizers in swift.
To tap and dismiss the menu control, use UITapGestureRecognizer
, bind it with a selector method and dismiss the controller/ view you are presenting. Check out the link to apple documentation for TapGesture : Guide
For swipe gesture, add Swipe gesture UISwipeGestureRecognizer
to the UIView, and write the dismiss method using slide animation for smooth UI. Swipe Gesture Guide
Let me know if you need any more help.
Upvotes: 1