2010-12-10 36 views
1

嗨 我的應用程序中有一個按鈕,我想將振動關聯起來。可以讓一些人告訴我將代碼放入與按鈕關聯的方法中。謝謝。如何將振動與按鈕單擊關聯

+1

接受你的其他問題的一些答案,然後你可以期待新的問題。 – 2010-12-10 09:59:41

+0

如何接受答案? – 2010-12-10 10:31:33

+0

說明:「當你決定哪個答案對你最有幫助時,通過點擊回答」 – Sergio 2010-12-10 16:24:49

回答

2

試試這個:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

不要忘了導入AudioToolbox/AudioToolbox.h

+0

謝謝你的答覆,但是,這對我不起作用 – 2010-12-13 05:33:02

+0

注意振動dosent在ipod中工作(未提供功能。)訪問http://www.macrumors.com/2010/09/08/fourth-generation-ipod-touch-does-have-vibration / – 2010-12-14 06:22:19

1

我們需要把線

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

用不同的方法,然後調用與該按鈕對應的方法中的方法。