Create
Singleton.h
<Foundation/Foundation.h> - ()playSoundWithName:(NSString *
Add the sound effects used by the APP to the newly created bound.
Create
Singleton.m
<AudioToolbox/AudioToolbox.h>*_soundDict; - (= _soundDict =
The system sound service uses SystemSoundID to play audio files. Multiple systemsoundids can be created for the same sound file.
System sound service is a C language framework.
To improve application performance and prevent audio files from being repeatedly loaded, the single-instance mode is usually used to process system sound playback.
Singleton. m implementation
Mark loads the specified audio file-(SystemSoundID) loadSoundWithURL :( NSURL * = &
Mark loads all audio files-(NSDictionary * NSString * mainBundlPath = * bundlePath = [mainBundlPath paths: NSArray * array = NSMutableDictionary * dictM = ^ (NSString * fileName, NSUInteger idx, BOOL * NSString * filePath = * fileURL =
Mark-play audio-() playSoundWithName :( NSString * = NSAssert (soundID>,
Click the button in the controller.
- (