如何玩iPhone Tap声音? [英] How to play iPhone tap sound?

查看:114
本文介绍了如何玩iPhone Tap声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone应用程式中有一个按钮,我想在点击时播放预设的「键盘点按」声音。我已经能够轻松地播放我自己的自定义的声音,但是有什么方法可以在我的应用程序中播放这样的默认系统声音。

I have a button in my iPhone app that I'd like to have play the default "keyboard tap" sound when it's tapped. I've been able to play my own custom sounds easily enough, but is there any way to play a default system sound like this in my app?

推荐答案

使用系统总数

您必须为此使用系统声音。以下可能be usefule.Refer多媒体编程指南知道更多。

usingsystemsounds
You must use the System Sound for this.The below might be usefule.Refer Multimedia Programming guide to know more.

CFBundleRef mainbundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef = CFBundleCopyResourceURL
                                     (mainbundle, CFSTR("tap"), CFSTR("aif"), NULL);
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundFileObject);

此外,您也可以使用内置的系统声音

Also you can use the inbuilt system sounds by

AudioServicesPlaySystemSound(1100);

这篇关于如何玩iPhone Tap声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆