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.
我在UIScrollView中有一个UIView。当我想在UIView上模拟拖动事件时,正在触发UIScrollView上的滑动事件。
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?
在ipad上我可以用两根手指两次轻扫和一根手指拖动。现在,我如何在模拟器上做类似的事情;拖动而不是滑动?
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
编辑1:我应该首先更清楚。无论如何,我的问题是鼠标拖动触发滑动而不是拖动,从而滚动滚动视图而不是将拖动事件传递给滚动视图包含的UIView。我在macbook pro上。触摸板上的双指滑动被忽略。触摸和拖动与鼠标拖动的效果相同。谢谢
3 个解决方案
#1
18
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.
请参阅Jeff LaMarche关于如何执行此操作的快速说明。它记录在您正在阅读的同一页面中,但Jeff的解释更清晰。
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.
如果要在iPhone模拟器中模拟双指手势,请按住选项键。您将在屏幕上获得两个点而不是一个点。两个点将默认为捏 - 如果您将点更靠近屏幕中心,另一个点朝向中心,可以轻松模拟捏合或捏合。
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.
如果你想做一个不同的双指手势,将两个点分开你想要它们的距离,然后按住shift键,同时按住选项键。这将锁定两个手指按压的位置,以便您可以执行双指滑动。
#2
3
see this documentation below: iOS Simulator User Guide
请参阅以下文档:iOS模拟器用户指南
Just use the mouse to drag the view, aka, left click the view then move the mouse
只需使用鼠标拖动视图,也就是说,左键单击视图然后移动鼠标
#3
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.
我最终禁用了从UI滚动并添加了两个按钮来滚动滚动视图。由于这只是模拟器的解决方法,因此在构建设备时使用#ifndef来隐藏按钮。
#1
18
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.
请参阅Jeff LaMarche关于如何执行此操作的快速说明。它记录在您正在阅读的同一页面中,但Jeff的解释更清晰。
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.
如果要在iPhone模拟器中模拟双指手势,请按住选项键。您将在屏幕上获得两个点而不是一个点。两个点将默认为捏 - 如果您将点更靠近屏幕中心,另一个点朝向中心,可以轻松模拟捏合或捏合。
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.
如果你想做一个不同的双指手势,将两个点分开你想要它们的距离,然后按住shift键,同时按住选项键。这将锁定两个手指按压的位置,以便您可以执行双指滑动。
#2
3
see this documentation below: iOS Simulator User Guide
请参阅以下文档:iOS模拟器用户指南
Just use the mouse to drag the view, aka, left click the view then move the mouse
只需使用鼠标拖动视图,也就是说,左键单击视图然后移动鼠标
#3
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.
我最终禁用了从UI滚动并添加了两个按钮来滚动滚动视图。由于这只是模拟器的解决方法,因此在构建设备时使用#ifndef来隐藏按钮。