在 iPhone 上模拟触摸 [英] Simulate touch on iphone

查看:27
本文介绍了在 iPhone 上模拟触摸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试模拟 UIWebView 上的触摸,如何以编程方式在某个位置触发触摸事件?(x 和 y 坐标)只是调用touchesBegan?

Im trying to simulate a touch on as UIWebView, how can I programmatically fire a touch event at a certain location? (x and y coordinates) Just call touchesBegan?

理想情况下,我希望在没有任何 javascript hack 的情况下进行,因为将来它可能不是 uiwebview

Ideally I'd like to do it without any javascript hack because in the future it may not be a uiwebview

推荐答案

在 iPhone 上合成一个触摸事件并不容易:你必须使用未公开的 API,所以你在 iOS 的每次更新上都有很大的可能会崩溃并被 Apple 拒绝.

It's not easy to synthesize a touch event on the iPhone: you have to use undisclosed API, so you have a high probability of breaking on every update of the iOS and getting rejecting from Apple.

这是一个演示如何在 iPhone 上合成一个触摸事件:

Here's a link that demonstrates how to synthesize a touch event on the iPhone:

这是关于 StackOverflow 的另一个问题:如何发送触摸事件到 iPhone 操作系统?

Here's another question on StackOverflow: How to send a touch event to iPhone OS?

这篇关于在 iPhone 上模拟触摸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆