ios模拟器:模拟滑动和拖动

发布于 2024-12-03 12:32:36 字数 858 浏览 2 评论 0原文

我在 UIScrollView 中有一个 UIView。当我想模拟 UIView 上的拖动事件时,会触发 UIScrollView 上的滑动事件。

根据 文档 ,没有滑动和拖动之间有很大区别。
滑动

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.


拖动

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

在 ipad 上,我可以使用两根手指两次滑动和一根手指拖动。现在,我该如何在模拟器上做类似的事情?拖动而不是滑动?

编辑1: 我应该首先说得更清楚。不管怎样,我的问题是鼠标拖动触发的是滑动而不是拖动,从而滚动滚动视图而不是将拖动事件传递给滚动视图包含的 UIView。 我用的是 MacBook Pro。触摸板上的两根手指滑动被忽略。触摸和拖动会导致与鼠标拖动相同的结果。 谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

枯叶蝶 2024-12-10 12:32:36

请参阅 Jeff LaMarche 的快速说明了解如何执行此操作。它记录在您正在阅读的同一页中,但杰夫的解释更清晰。

如果您想在 iPhone 模拟器中模拟两指手势,请按住 option 键。您将在屏幕上看到两个点,而不是一个。这两个点将默认为捏合 - 如果您将一个点靠近屏幕中心,另一个点就会靠近中心,从而可以轻松模拟捏合或捏合。

如果您想要执行不同的两指手势,请将两个点的距离设置为您想要的距离,然后按住 Shift 键,同时仍按住 Option 键。这将锁定两根手指按下的位置,以便您可以执行两根手指滑动等操作。

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.

掩耳倾听 2024-12-10 12:32:36

请参阅下面的文档:
iOS 模拟器用户指南

只需使用鼠标拖动视图,即左键单击然后移动鼠标查看视图

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

策马西风 2024-12-10 12:32:36

我最终禁用了 UI 的滚动,并添加了两个按钮来滚动滚动视图。由于这只是针对模拟器的解决方案,因此我在为设备构建时使用#ifndef 隐藏按钮。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文