I have a view built through IB, there's a text view and and button on it. When the view shows up I would like to have the keyboard to be already displayed.
I tried to set the first responder in the didViewLoad but that didn't work.
I do have an IBOutlet that is connected to the textView and related accessor.
Notifies the receiver that it's about to become first responder in its NSWindow .
becomeFirstResponder()Asks UIKit to make this object the first responder in its window.
The first responder is usually the first object in a responder chain to receive an event or action message. In most cases, the first responder is a view object that the user selects or activates with the mouse or keyboard.
If you want that text control to stop waiting for input – which in turn dismisses the keyboard – you should call its resignFirstResponder() method, which passes the first responder baton to the next waiting component.
Looks like you may have accidentally misspelled the method name didViewLoad instead of viewDidLoad. All you should need there (assuming your IBOutlet is connected in IB) is the following:
[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