我想在用戶觸摸視圖時檢測JUST雙擊/單擊。只用UIViews檢測雙擊或單擊?
我做了這樣的事情:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint prevLoc = [touch ]
if(touch.tapCount == 2)
NSLog(@"tapCount 2");
else if(touch.tapCount == 1)
NSLog(@"tapCount 1");
}
但它總是前2分接頭檢測1次點擊。我怎樣才能檢測到只有1/2的水龍頭?
我覺得這是更好的辦法。 http://stackoverflow.com/questions/7175086/iphone-single-tap-gesture-conflicts-with-double-one – KJLucid