【发布时间】:2014-01-19 14:58:39
【问题描述】:
我正在尝试播放按钮点击声音,我也应该能够管理点击声音以及音量按钮。
我所做的是 将 AVFoundationFramework 添加到项目中,
在.h文件中
#import <AVFoundation/AVAudioPlayer.h>
#import <AVFoundation/AVFoundation.h>
在.m文件下的按钮点击方法
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"sound1" ofType:@"mp3"];
NSURL *soundUrl = [NSURL fileURLWithPath:soundPath];
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithURL:soundUrl];
[player play];
但我收到上述错误。任何帮助将不胜感激。
【问题讨论】:
标签: ios audio uibutton avfoundation