Adding Input Clicks
Use the UIDevice
class to add input clicks to your custom input accessory views. The playInputClick
method plays the standard system keyboard click and can be called when you respond to user input taps.
Adopt the UIInputViewAudioFeedback
protocol in the accessory input class and add an enableInputClicksWhenVisible
delegate method that always returns YES
. This defers audio playback to the user’s preferences, which are set in Settings > Sounds. To hear these clicks, the user must have enabled keyboard click feedback. If the user has not done so, your calls to playInputClick
are simply ignored.
@interface ColorView : UIView @property ...
Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.