- Joined
- Mar 9, 2012
- Messages
- 11
- Reaction score
- 0
- Points
- 1
Hey guys I'm having a small problem connecting the code for the sound to the button.
I created a project "Tabbed application" and then i added an image to the first and second view, then i added audio.toolbox.framework in the "link binary with library" section under build phases section. Then created round rect buttons and put them where they needed to be. Heres when the problem starts, when i click on one of the buttons and press ctrl a light blue line appears and i drag it to the code for that button in the .m file but it won't connect to it nothing happens. Could somebody please help me with this ?
Here the code i wrote for the button but I'm pretty sure its fine
I created a project "Tabbed application" and then i added an image to the first and second view, then i added audio.toolbox.framework in the "link binary with library" section under build phases section. Then created round rect buttons and put them where they needed to be. Heres when the problem starts, when i click on one of the buttons and press ctrl a light blue line appears and i drag it to the code for that button in the .m file but it won't connect to it nothing happens. Could somebody please help me with this ?
Here the code i wrote for the button but I'm pretty sure its fine
Code:
-(IBAction)sound1 {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"sound1", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}