SystemSoundID soundID;
NSString *path = [[NSBundle mainBundle] pathForResource:@"static" ofType:@"caf"];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID);
AudioServicesPlaySystemSound(soundID);
我已在我的应用程序中实现了上述代码。
它工作得很好,但问题是我不知道如何阻止它。
即声音为 10 秒。
10秒前如果用户点击按钮,声音应该停止吗?我怎样才能这样做?
最佳答案
尝试 AudioServicesDisposeSystemSoundID,它会立即停止声音。如果您打算再次使用它,则需要重新创建声音。
关于iphone - 停止 iPhone 中的声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1512121/