ios模拟器:模拟滑动和拖动
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅 Jeff LaMarche 的快速说明了解如何执行此操作。它记录在您正在阅读的同一页中,但杰夫的解释更清晰。
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.
请参阅下面的文档:
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
我最终禁用了 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.