So I want to bring in a modal view controller that has a UITextView in it and I want the keyboard to automatically popup and the UITextView have focus.
I found a way to accomplish this by doing the following:
textView.editable = YES; textView.editable = NO; This just seems hacky to me, is there another way?
Since UITextView inherits from UIResponder (indirectly, it actually inherits from UIScrollView, which inherits from UIView which then inherits from UIResponder) you can call the -becomeFirstResponder method on your text field, which will cause it to become the first responder and begin editing:
[textView becomeFirstResponder];
Swift:
textView.becomeFirstResponder()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With