2

Can anyone tell me how I can discover if the user has enabled/disabled that annoying click when they type, I'd like to use that as a default to indicate whether I should make a click when they click something.

Thanks, vic

vickirk
  • 3,766
  • 2
  • 20
  • 35
  • That would need undocumented API. Why not just make it an option? – kennytm Oct 29 '10 at 19:34
  • 1
    possible duplicate of [How to check iPhone keyboard klick sound turned on/off in settings ?](http://stackoverflow.com/questions/2704074/how-to-check-iphone-keyboard-klick-sound-turned-on-off-in-settings) – kennytm Oct 29 '10 at 19:35
  • @KennyTM Thanks for that, i did search but just found people asking how to play the sound. I do have it as an option, I just want to use the system preference as my default. – vickirk Oct 29 '10 at 20:03

2 Answers2

10

You can't access the system preference, but as of iOS 4.2 you can ask the system to make the click sound if the user's setting allows it. Add the UIInputViewAudioFeedback protocol to your view's declaration, like:

@interface MyView : UIView <UIInputViewAudioFeedback>

Then implement the enableInputClicksWhenVisible method

- (BOOL)enableInputClicksWhenVisible
{
    return YES;
}

and call

[[UIDevice currentDevice] playInputClick];

to play that annoying click sound.

See http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/InputViews/InputViews.html%23//apple_ref/doc/uid/TP40009542-CH12-SW4

davehayden
  • 3,464
  • 19
  • 28
  • I did this but don't hear any sound. My general preferences have keyboard clicks "on". In my ViewController I call the playInputClick from an IBAction which is linked up to my UIButton, which in turn is a "sub-object" of my custom View called "MyView". I'm using iOS5 b7 could it have to do with that? Can one even use this method for UIButtons, or does it only work with the "standard" keyboards? – Joseph Sep 30 '11 at 14:02
  • 1
    from reading the docs (and my testing in iOS6), I think that is only supported for keyboard accessory views (or inputViews set on UITextField or something), not just any view you show. – Jason Sep 20 '12 at 15:17
3

As far as I know, access to the user's general preferences is not allowed in the public API. Best you can do is make a feature request/file a bug report at:

https://bugreport.apple.com/

Dave Klotz
  • 286
  • 2
  • 7
  • Thats what i was starting to think. You would think that if they want to keep apps consistent they'd open the (or some) system settings up. Now that they allow custom keyboards on the ipad are we going to have to disable the clicking noise in every applications settings :-( – vickirk Oct 29 '10 at 20:40
  • Yeah, I'm in the same bind. Had to make a decision do I want them to always click, or never click. Hopefully they will start allowing at least read access to some of these settings. – Dave Klotz Oct 30 '10 at 00:05