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
Try UIDevice
's playInputClick:
[[UIDevice currentDevice] playInputClick];
From the documentation:
Use this method to play the standard system keyboard click in response to a user tapping in a custom input or keyboard accessory view. A click plays only if the user has enabled keyboard clicks in Settings > Sounds, and only if the input view is itself enabled and visible.
Make sure you adopt the UIInputViewAudioFeedback
protocol in your input view class, and implement the enableInputClicksWhenVisible
delegate method to return YES
, as per the documentation.
EDIT - For implementation of delegate methods, check out Apple's documentation on custom input views.