我在Snow Leopard上写了一个Mac OS X应用程序.我有一个步骤方法,由NSTimer定期触发.在这种方法中,我想将鼠标移动到屏幕的中心,没有按下或释放按钮.这就是我所拥有的:
-(void) step: (NSTimer *) timer
{
NSRect bounds = [self bounds];
CGPoint point = CGPointMake(bounds.origin.x + bounds.size.width / 2.0f, bounds.origin.y + bounds.size.height / 2.0f);
CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDragged, point, 0);
}
Run Code Online (Sandbox Code Playgroud)
这没有任何作用.有人能告诉我什么是错的吗?
归档时间: |
|
查看次数: |
1823 次 |
最近记录: |