是否有任何其他的iOS系统声音不是'滴答'其他可用? [英] Are there any other iOS system sounds available other than 'tock'?
问题描述
我已经在我的第一个iPhone应用程序实现了另一种键盘。我想播放声音时,按钮pssed $ P $。当标准键盘pssed将被罚款$ P $,但我不知道怎么去那声音的默认点击声。
I have implemented an alternative keyboard on my first iPhone app. I would like to play a sound when a button is pressed. The default click sound when the standard keyboard is pressed would be fine, but I don't know how to get that sound.
在这个答案,我发现怎么玩一个滴答的声音:
In this answer I found how to play a 'tock' sound:
<一个href=\"http://stackoverflow.com/questions/7831671/playing-system-sound-without-importing-your-own\">Playing系统声音不导入自己
我得到这个工作很轻松了,但它是一个非常响亮的声音。我搜索堆栈溢出和可用的iOS系统的的X code有助于听起来比'滴答'等,我无法找到他们。
I got this to work easily enough but it is a very loud sound. I've searched Stack Overflow and the Xcode help for available iOS system sounds other than 'tock' and I can't find them.
是否有其他内置的声音,甚至默认的键盘声,我可以使用?
Are there other built-in sounds, maybe even the default keyboard sound, that I can use?
推荐答案
在此之前,自近2个星期前发布这个问题我已搜查高和低,使我的应用程序键盘的点击声工作的方法。我试图执行和理解的<一个href=\"http://developer.apple.com/library/IOs/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/InputViews/InputViews.html#//apple_ref/doc/uid/TP40009542-CH12-SW4\">Apple's自定义输入视图文档。我宰了我的应用程序在许多方面试图使其工作,创造了几个测试项目。我试着间preT如何从网络上的其他各种来源的做到这一点。一切都是徒劳。我已经完成我的应用,但对于这最后的功能。
Prior to, and since posting this question almost 2 weeks ago I have searched high and low for a method to make the keyboard click sound work in my app. I have attempted to implement and understand Apple's documentation on custom input views. I butchered my app in many ways attempting to make it work and created several test projects. I tried to interpret how to do this from various other sources on the web. All to no avail. I have finished my app all but for this last function.
我终于打一个简单的答案对的<一个结束href=\"http://www.iphonedevsdk.com/forum/iphone-sdk-development/103267-uiinputviewaudiofeedback-not-working.html\">this IPhone开发SDK的形式问题/后。最终的答案很简单,可以在这些简单的步骤几秒钟内完成。
I finally hit on a simple answer towards the end of this IPhone Dev SDK form question/post. The ultimate answer is easy and can be done in a few seconds with these easy steps.
-
关联的AudioToolbox.framework到项目(点击您的项目目标,选择构建阶段,并在链接二进制与图书馆项单击+按钮,添加框架。
Link the 'AudioToolbox.framework' to your project (Click on your project's Target, select 'Build Phases' and under the 'Link Binary with Libraries' item click the + button and add the framework.
以下添加到您想要实施点击类的头文件:
Add the following to the header file of the class where you want to implement the click:
#import <AudioToolbox/AudioToolbox.h>
添加code的下面一行,无论你想键盘的点击声出现你的类的实现文件:
Add the following line of code in the implementation file of your class wherever you want the keyboard click sound to appear:
AudioServicesPlaySystemSound(0x450);
这就是它!和它的工作!哈利路亚!
THAT'S IT! AND IT WORKED!!! HALLELUJAH!
据保罗在其他论坛上有以下缺点:
According to Paul in the other forum this has the following downside:
键盘的按键不会被iOS的用户preference影响键盘声音开/关。
"keyboard keys won't be affected by the iOS user preference for keyboard sound on/off."
但是,当我把音量向上或向下在我的iPhone或者如果我静音iPhone,键盘点击时声音也有涨有跌还是静音正如所预料的。鉴于我发现它不可能实现键盘点击UIInputViewAudioFeedback作为记载,我很高兴能有什么工作。
But when I turn the volume up or down on my iPhone or if I mute the iPhone, the keyboard click sounds do go up and down or are muted as would be expected. Given that I found it impossible to implement keyboard clicks "UIInputViewAudioFeedback" as documented, I'm happy to have anything work.
P.S。如果任何人有一个链接到一个实际的项目,我可以下载,并建立在我的iPhone上运行,看看究竟如何正确地贯彻:UIInputViewAudioFeedback我很乐意给它看看。但到目前为止,我没有发现,也没有对如何使其发挥作用的任何一步一步新手风格的说明。
P.S. If anyone has a link to an actual project that I can download, build and run on my iPhone to see EXACTLY how to properly implement: "UIInputViewAudioFeedback" I'd be happy to give it a look. But so far I've found none, nor any step-by-step newbie style instructions on how to make it work.
[2012年9月30日更新:] 我很高兴地说,我的应用程序被接受为使用此方法的应用程序商店。在这里,它是:<一href=\"https://itunes.apple.com/app/fine-tip-tip-calculator/id563429225\">https://itunes.apple.com/app/fine-tip-tip-calculator/id563429225
[Sept 30, 2012 UPDATE:] I'm happy to say that my app was accepted into the app store using this method. Here it is: https://itunes.apple.com/app/fine-tip-tip-calculator/id563429225
...戴尔
这篇关于是否有任何其他的iOS系统声音不是'滴答'其他可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!