Search code examples
iosipaduipangesturerecognizer

iOS detect drag outside left edge of screen


In iPad when you put your finger outside top or bottom edge of screen and then drag it on screen a menu is revealed. How can I implement that?


Solution

    • There is specifically a Gesture Recogniser class for this, introduced in iOS 7. It's the UIScreenEdgePanGestureRecognizer. The documentation for it is here. Check it out.

    • To test this in the simulator, just start the drag from near the edge (~15 points).

    • Also, you will have to create a gestureRecognizer for each edge. You can't OR edges together, so UIRectEdgeAll won't work.

    There is a simple example here. Hope this helps!