2009-06-25 16 views

回答

7
- (void) touchesBegan:(NSSet *) touches withEvent:(UIEvent *) event 
{ 
    UITouch *touch = [touches anyObject]; 
    if (touch.tapCount == 2) 
    { 
     // do your stuff here 
    } 
} 
1

實現的在UIResponder限定的觸摸功能之一(的touchesBegan,touchedEnded等...)。當你的觸摸陣列,可以使用如下代碼獲得UITouch的敲擊次數:

UITouch * t = [touches anyObject]; 
NSLog(@"%d", [t tapCount]); 
+0

它總是在模擬器 – 2009-06-27 05:24:53