Le_Coeur
Le_Coeur

Reputation: 1541

Block keyboard for input

How can I block keyboard for input (something like userInteractionEnabled = NO) in iOS >= 4 ?

Keyboard is used for TextEdit.

If I disable interaction for textedit then keyboard disappears, but I want to see the keyboard.

Upvotes: 1

Views: 955

Answers (3)

Mike Katz
Mike Katz

Reputation: 2080

You can always disable userInteractionEnabled on the keyboard view, or less-dangerously add an invisible subview to the keyboard that blocks interaction. See iOS: How to access the `UIKeyboard`? on how to get the UIView for the keyboard.

Upvotes: 0

iphonedev23
iphonedev23

Reputation: 991

have you tried this delegate?

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

Upvotes: 4

Stavash
Stavash

Reputation: 14304

Le Coeur, I think you need to consider a different approach to whatever you're trying to achieve by restricting the keyboard input for two good reasons:

  1. A UIElement that engages the user to type but doesn't react to any of the user's gestures is sure to be rejected by Apple.

  2. Because this keyboard is on the OS level, it is private API and I am pretty sure there is nothing you can do to the keyboard to block access to the keys.

Hope this helps

Upvotes: 1

Related Questions