我已经创建了自定义键盘UIView
。 但是我没有听到键盘的咔嗒声。 所以我尝试了下面的代码。但我听不到任何东西。 如何播放键盘声音?如何在自定义键盘中播放键盘声音?
NSURL* musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Tock"
ofType:@"aiff"]];
AVAudioPlayer *click = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil];
[click setVolume:0.15f];
[click play];
而且我还尝试了下一个。
AudioServicesPlaySystemSound(0x450);
我该怎么办?
我按照说明操作,但是,在我的键盘上没有点击声音。在系统键盘上点击声音。 – 2014-08-19 14:29:37