I'm having a bit of a problem trying to get touchesBegan to respond to multi touch.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet *allTouches = [event allTouches];
for (UITouch *touch in allTouches)
{
CGPoint location = [touch locationInView:touch.view];
if(CGRectContainsPoint(snare.frame, location) && lastButton != snare) {
//Swap Image
snareImg.image = snareImgDown;
[self performSelector:@selector(swapBack) withObject:nil afterDelay:0.1];
//Play Sound
NSString *path = [[NSBundle mainBundle] pathForResource:@"snare"
ofType:@"wav"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path]
, &soundID);
AudioServicesPlaySystemSound (soundID);
//
lastButton = snare;
}
else if(CGRectContainsPoint(hiHat.frame, location) && lastButton != hiHat) {
//Play Sound
NSString *path = [[NSBundle mainBundle] pathForResource:@"hi_hat"
ofType:@"wav"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path]
, &soundID);
AudioServicesPlaySystemSound (soundID);
//
lastButton = hiHat;
}
Im unclear of how to get it setup so that it will respond to multi touch, right now touchesBegan only works with 1 press. I know there something like im assuming a for(UITOuch *t in something) I cant remember how it works exactly.
Any one know how to do it?
Thanks in advanced.