我需要伪装iOS 7设备上的触摸事件。我已经浏览了一些可用的资源,但找不到任何关于iOS 7的内容。
以下是我要实现的目标:
在iOS 7设备上运行的iOS后台代码,它将侦听套接字,客户端应用程序将向其发送鼠标按键,这些按键被转换为触摸/滑动等事件。
我也经历了这个链接http://blog.lazerwalker.com/blog/2013/10/16/faking-touch-events-on-ios-for-fun-and-profit,但也有人说GSEvent会在iOS 7中无声地失败。
如果有办法实现这一点,请告诉我。
答案 0 :(得分:0)
查看ControlFreak 因此,添加并导入后,您可以执行触摸
- (void)performTouchInView:(UIView *)view
{
UITouch *touch = [[UITouch alloc] initInView:view];
UIEvent *eventDown = [[UIEvent alloc] initWithTouch:touch];
[touch.view touchesBegan:[eventDown allTouches] withEvent:eventDown];
[touch setPhase:UITouchPhaseEnded];
UIEvent *eventUp = [[UIEvent alloc] initWithTouch:touch];
[touch.view touchesEnded:[eventUp allTouches] withEvent:eventUp];
}
您也可以指定触摸点
UITouch *touch = [[UITouch alloc] initInView:view xcoord:100 ycoord:100];