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];
Run Code Online (Sandbox Code Playgroud)
从这里 http://cocoawithlove.com/2008/10/synthesizing-touch-event-on-iphone.html
| 归档时间: |
|
| 查看次数: |
9403 次 |
| 最近记录: |