heey...
I have two buttons (Button 1 and button 2) and if i press button 1, note1 starts and if i press button 2, note 2 starts. So what I try to do is: press button one (note1 starts) and SLIDE to button2 and than should note2 start. Like you slide without lifting your finger over a piano keyboard and all notes from c to h sound.
I did this with UIImageViews and i did it also with UIButtons. If i press the c1pianoview it sounds a "c". if i press the d1pianoview it sounds a "d". But if i slide without lifting my finger from c1pianoview to d1pianoview it only sounds a "c". What did I wrong? Can I do it also with UIButtons? Touch down works but sliding does'nt work! Can somebody help me, please? Here my code!
-(void)touchesBeganNSSet *)touches withEventUIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
if(CGRectContainsPoint(c1pianoview.frame, location))
{ NSString *path = [[NSBundle mainBundle]
pathForResource: @"c1piano" ofType:@"mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPathath] error:NULL];
[theAudio play];
}
if(CGRectContainsPoint(d1pianoview.frame, location))
{ NSString *path = [[NSBundle mainBundle]
pathForResource: @"d1piano" ofType:@"mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL fileURLWithPathath] error:NULL];
[theAudio play];
}
}
Thx for help!