반응형
#import <AudioToolbox/AudioToolbox.h>
- (void)playClick
{
NSString *sndpath = [[NSBundle mainBundle] pathForResource:@"click" ofType:@"wav"];
CFURLRef baseURL = (CFURLRef)CFBridgingRetain([NSURL fileURLWithPath:sndpath]);
SystemSoundID sysSound;
AudioServicesCreateSystemSoundID(baseURL, &sysSound);
CFRelease(baseURL);
AudioServicesAddSystemSoundCompletion(sysSound, NULL, NULL, _systemSoundDidComplete, NULL);
AudioServicesPlaySystemSound(sysSound);
}
void _systemSoundDidComplete(SystemSoundID ssID, void *clientData)
{
AudioServicesDisposeSystemSoundID(ssID);
}
반응형
'IPHONE' 카테고리의 다른 글
아카이브에 저장하고 불러 오기 샘플 코드. (0) | 2013.09.04 |
---|---|
Local Notification (0) | 2013.07.10 |
UIActionSheet 사용하기. (0) | 2013.05.30 |
UIViewAlert 사용하기. (0) | 2013.05.30 |
네비게이션바, 툴바 보이게하기. (0) | 2013.05.20 |