disabling keyboard in UITextField

Hi! i would like to prevent the iphone keyboard from appearing in the first place when a user clicks on my text field..

Does anyone know how can i do that?

thanks.

Mac OS X (10.5.4)

Posted on Jul 20, 2008 12:37 PM

Reply
13 replies

Aug 5, 2008 6:52 PM in response to matan.elgabsi

you missed out the other stuff you need:

- (void)viewWillAppear:(BOOL)animated
{
// watch the keyboard so we can adjust the user interface if necessary.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:self.view.window];
}

- (void)viewWillDisappear:(BOOL)animated
{
[self setEditing:NO animated:YES];

// unregister for keyboard notifications while not visible.
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
}

Aug 20, 2008 10:20 AM in response to matan.elgabsi

How about playing with the responder class?

becomeFirstResponder
Notifies the receiver that it’s about to become first responder in its window.
- (BOOL)becomeFirstResponder
Discussion
The default implementation returns YES, accepting first responder status. Subclasses can override
this method to update state or perform some action such as highlighting the selection, or to return
NO, refusing first responder status.

If you return NO, then perhaps you can bring up your own keyboard.

However I expect you will not get the blinking cursor...

michael golden

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

disabling keyboard in UITextField

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.