【发布时间】:2010-11-05 21:24:31
【问题描述】:
如何在模拟器中计算双击次数?
【问题讨论】:
标签: objective-c iphone xcode ios-simulator
如何在模拟器中计算双击次数?
【问题讨论】:
标签: objective-c iphone xcode ios-simulator
- (void) touchesBegan:(NSSet *) touches withEvent:(UIEvent *) event
{
UITouch *touch = [touches anyObject];
if (touch.tapCount == 2)
{
// do your stuff here
}
}
【讨论】:
实现 UIResponder 中定义的触摸函数之一(touchesBegan、touchedEnded 等...)。当您获得 touches 数组时,您可以使用如下代码获得 UITouch 的点击次数:
UITouch * t = [touches anyObject];
NSLog(@"%d", [t tapCount]);
【讨论】: