iOS:CCTouchesBegind是否可以包含多个触摸?
我想知道CCToucheSBegind中的NSSet触控是否可以包含多个触控。 我做了一些测试,触摸次数总是1 谁能证实这一点?如果只有一次触摸,为什么会有一套呢iOS:CCTouchesBegind是否可以包含多个触摸?,ios,cocos2d-iphone,touch,touch-event,Ios,Cocos2d Iphone,Touch,Touch Event,我想知道CCToucheSBegind中的NSSet触控是否可以包含多个触控。 我做了一些测试,触摸次数总是1 谁能证实这一点?如果只有一次触摸,为什么会有一套呢 -(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 看看这个 -(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSSet *set = [event a
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
看看这个
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *set = [event allTouches];
if (set.count == 1) { //first touch
}
if (set.count == 2) { //second touch
} //etc.
给你,伙计
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch =[[[event allTouches] allObjects] lastObject];
//NSLog(@"touchesBegan ...");
switch ([touch tapCount])
{
case 1:
[self performSelector:@selector(oneTap) withObject:nil afterDelay:.5];
break;
case 2:
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(oneTap) object:nil];
[self performSelector:@selector(twoTaps) withObject:nil afterDelay:.5];
break;
case 3:
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(twoTaps) object:nil];
[self performSelector:@selector(threeTaps) withObject:nil afterDelay:.5];
break;
default:
break;
}
};
- (IBAction)oneTap
{
NSLog(@"oneTap ...");
}
- (IBAction)twoTaps
{
NSLog(@"twoTaps ...");
}
- (IBAction)threeTaps
{
NSLog(@"threeTaps ...");
}