我知道可以拦截屏幕上的点击,但是我想知道是否有可能在屏幕的某个点(带有x和y坐标)模拟点击。
谢谢

最佳答案

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];

[eventDown release];
[eventUp release];
[touch release];

从这里
http://cocoawithlove.com/2008/10/synthesizing-touch-event-on-iphone.html

关于iphone - 模拟水龙头,可以吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5160952/

10-09 02:21