4
我正在Snow Leopard上編寫Mac OS X應用程序。我有一個由NSTimer定期觸發的步驟方法。在這種方法中,我想將鼠標移動到屏幕的中心,沒有按鈕被按下或釋放。以下是我的:Cocoa Move Mouse
-(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);
}
這什麼都不做。有人可以告訴我有什麼問題嗎?
工作完美。謝謝。 – LandonSchropp 2010-12-12 11:37:30