i'm new in Objective C, i'm developing an app that play sound on touch event of an uibutton. When i touch the button, it change is image and audio starts to playing. When audio is finish to play, i want to put the original image of uibutton. How can i do that? How can i catch the event of the audio that is finish? i'm using that code:
- (SystemSoundID) createSoundID: (NSString*)name
{
NSString *path = [NSString stringWithFormat: @"%@/%@",
[[NSBundle mainBundle] resourcePath], name];
NSURL* filePath = [NSURL fileURLWithPath: path isDirectory: NO];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
return soundID;
}
In
viewDidLoad
i call
freq = [self createSoundID: @"freq.wav"];
and in function that is called on button's touch i use:
AudioServicesPlaySystemSound(freq);
How can i do? Thank you!