Is it possible to do an edge swipe in iOS simulator?

你离开我真会死。 提交于 2021-01-21 13:41:04

问题


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.


回答1:


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.




回答2:


On Simulator Version 11.4 I see the option

  • Window -> Show Device Bezels

which shows a virtual device frame around the simulated phone:

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



来源:https://stackoverflow.com/questions/19127383/is-it-possible-to-do-an-edge-swipe-in-ios-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!