17

iOS 7 provides for a UIScreenEdgePanGestureRecognizer which detects swipes in from edges of the screen. Can this gesture be simulated using the iOS7 simulator in Xcode? Clicking and dragging outside the screen area just moves the whole simulator frame around.

user2709279
  • 353
  • 1
  • 3
  • 15

2 Answers2

33

On Simulator Version 11.4 I see the option

  • Window -> Show Device Bezels

which shows a virtual device frame around the simulated phone:

enter image description here

This allows to start the gesture "outside" of the screen. I could successfully trigger a UIScreenEdgePanGestureRecognizer from the left.

Bruno Bieri
  • 9,724
  • 11
  • 63
  • 92
  • I have been struggling with this all day long. It is working now with the default configuration of the navigation controller when dragging from the bezel. Thank you! – VoodooBoot Jul 31 '20 at 21:56
21

You don't have to swipe across the edges to trigger a UIScreenEdgePanGestureRecognizer, just start very close to the edge. It works if I start not more than ~15 points from the edge.

(this if for the simulator. I never tested this on a device)


As a side note: You have to create a gestureRecognizer for each edge. You can't OR edges together, so UIRectEdgeAll won't work.

Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
  • 5
    In the [documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScreenEdgePanGestureRecognizer_class/Reference/Reference.html), it gives the impression that we are able to OR the edges together. But in practice, you are right that each edge is treated separately. – Jon Nov 04 '13 at 23:58
  • 1
    I upvoted you because of the side note. I was debugging the OR for a while until I realized that this is indeed the case. I don't know if it was implied but I did not get the sense from the documentation – johncch Feb 06 '14 at 03:05
  • Thanks @Jon! It wasn't working until I did that. Here's a sample [Xcode project and code for the UIScreenEdgePanGestureRecognizer](http://iphonedev.tv/blog/2014/3/21/screen-edge-swipe-gesture-on-iphone-using-the-uiscreenedgepangesturerecognizer-tutorial). – Paul Solt Apr 03 '14 at 15:37
  • The newer answer from 2020 is a far better way to go. Thanks. – Dan Rosenstark Mar 23 '23 at 20:57