如何在点击 UIButton 时播放 MP3?
任何人都可以给我如何通过点击 UIButton 来播放声音的示例代码吗?
我想使用 AVAudioPlayer 播放 MP3 文件
Can anyone please give me sample code of how sound is played with a UIButton being tapped?
I would like to play an MP3 file using AVAudioPlayer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的事情应该可以帮助你开始。将其添加到您的视图控制器中,然后将按钮连接到界面生成器中的 playAudio 操作。
在你的标题中 .h
在你的 .m 中
something like this should get you started. Add this to your view controller, then hook up the button to the playAudio action in interface builder.
in your header .h
in your .m