"Plays Sound" Property of UIButton in Interface Builder

interface-builder, ios, iphone, objective-c

Solution

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,

- Adopt the `UIInputViewAudioFeedback` protocol in your input view class.

- 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.

Problem

in interface builder there is property of UIButton under Accessibility that says "Plays Sound". Can any one explain what is this. Actually i am making an application which play sound on every button click and i can disable sounds from setting screen. Will this property of UIButton can help me? Thanks

Original source

Related problems