16

I have a UIView within a UIScrollView. When i want to simulate the drag event on the UIView, swipe event on the UIScrollView is being triggered.

As per the documentation , there isn't much of a difference between swipe and drag.
Swipe

1- Place the pointer at the start position.  
2- Hold the mouse button. 
3- Move the pointer in the swipe direction and release the mouse button.


Drag

1- Place the pointer at the start position.
2- Hold down the mouse button.
3- Move the pointer in the drag direction.

On an ipad I can use two fingers two swipe and one finger to drag. Now, how do i go about doing something similar on the simulator; drag instead of a swipe?

Edit 1: I should have been clearer first up. Anyway, my problem is that the mouse drag is firing the swipe instead of drag, thereby scrolling the scroll view instead of passing on the drag event to the UIView contained by the scroll view. I am on macbook pro. Two-finger swipe on the touchpad is being ignored. Touch and drag is causing the same thing as mouse-drag. Thanks

Srisa
  • 967
  • 1
  • 7
  • 17
  • possible through using macbook touchpad/magic trackpad? – Marek Sebera Sep 09 '11 at 13:04
  • @Marek Touch pad isn't being of much help. Two finger swipe is being ignored, nothing happens. Hold and drag is causing the same effect as mouse drag. I have updated the question. – Srisa Sep 09 '11 at 13:16
  • Hmm there is kind of problem with gestures and scrollView, since it receive events first ... If you really wanna do this, I think you should override the hitTest:withEvent: and check which view has the event and pass to it – Herz Rod Sep 09 '11 at 13:48

3 Answers3

21

See Jeff LaMarche's quick note on how to do this. It's documented in the same page you're reading, but Jeff's explanation is clearer.

If you want to simulate a two-finger gesture in the iPhone simulator, hold down the option key. You will get two dots on the screen instead of one. The two dots will default to pinching - if you bring the dot closer to the center of the screen, the other dot comes toward the center, making it easy to simulate a pinch in or pinch out.

If you want to do a different two-finger gesture, get the two dots the distance apart that you want them to be, then hold down the shift key, while still holding down the option key. That will lock the position of the two finger presses together so you can do, for example, a two-finger swipe.

Community
  • 1
  • 1
Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • @Rob My problem is that mouse-drag is firing the swipe (two finger gesture). I am not able to fire the drag event (one finger gesture). Updated the question. – Srisa Sep 09 '11 at 13:17
6

see this documentation below: iOS Simulator User Guide

Just use the mouse to drag the view, aka, left click the view then move the mouse

nyus2006
  • 411
  • 6
  • 12
-1

I ended up disabling the scrolling from the UI and added two buttons to scroll the scroll view. Since this is a work around only for the emulator, I have used #ifndef to hide the buttons while building for the device.

Srisa
  • 967
  • 1
  • 7
  • 17