ios simulator: simulate swipe and drag
Asked Answered
L

3

20

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

Lightish answered 9/9, 2011 at 12:58 Comment(3)
possible through using macbook touchpad/magic trackpad?Paphos
@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.Lightish
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 itRianna
L
-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.

Lightish answered 3/1, 2012 at 11:37 Comment(1)
This does not answer the original question presented.Lampkin
G
24

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.

Ge answered 9/9, 2011 at 13:3 Comment(1)
@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.Lightish
L
7

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

Lipson answered 5/11, 2013 at 14:13 Comment(0)
L
-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.

Lightish answered 3/1, 2012 at 11:37 Comment(1)
This does not answer the original question presented.Lampkin

© 2022 - 2024 — McMap. All rights reserved.