Play Keyboard Click Sound in a Collection View Controller

Plays Sound Property of UIButton in Interface Builder

You can use [[UIDevice currentDevice] playInputClick]; to play the keyboard input click sound which is available in UIDevice. Check this apple documentation for more details.

You need to do the following for this,

  1. Adopt the UIInputViewAudioFeedback protocol in your input view class.
  2. Implement the enableInputClicksWhenVisible delegate method to return YES.

Do this in UIView class,

@interface MyView : UIView <UIInputViewAudioFeedback>

Then implement enableInputClicksWhenVisible method

- (BOOL)enableInputClicksWhenVisible
{
return YES;
}

If you are facing issues with this, you can check this.

iPhone: how to make key click sound for custom keypad?

The simplest way I've found is to extract Tock.aiff (the keyboard sound) from the iPhone Simulator and package it with your app, then play it using AudioServicesPlaySystemSound() at the appropriate time. On my machine, simply typing Tock.aiff into Spotlight turns up the file, but if you have to go looking for it, it's in the simulator version of UIKit.framework.

Playing audio from a selected table cell stored in an array created from a Struct

Try deleting .mp3 from the URLs in audios. URLForResource:withExtension: takes the extension separately.



Related Topics



Leave a reply



Submit