Monday, July 19, 2010

UITextView automatic keyboard display

I've come across a few instances where my view is simply a UITextView for the user to enter some text into, such as for a comment field, or a twitter entry, etc. In these scenarios it is best to automatically show the UIKeyboard for the user to just start typing. This is a really easy one, all you have to do is have the synchronized UITextView become the first responder to make the keyboard appear:

- (void)viewDidLoad {
    [super viewDidLoad];
    [commentTxt becomeFirstResponder];
}

You can use the same technique with UITextFields too.

1 comment:

  1. Thanks dude you are the best ;) save my day really thank you!!!

    ReplyDelete