How do I show the keyboard by default in UITextView?

How do I show the keyboard by default in UITextView?

I want to create a view that consists solely of a UITextView. When the view is first shown, by default, I'd like the keyboard to be visible and ready for text entry. This way, the user does not have to touch the UITextView first in order to begin editing.

Is this possible? I see the class has a notification called UITextViewTextDidBeginEditingNotification but I'm not sure how to send that, or if that is even the right approach.

declaring global variables in iPhone project


Where's the difference between setObject:forKey: and setValue:forKey: in NSMutableDictionary?
to accomplish this just send the becomeFirstResponder message to your UITextField, as follows (assuming you have an outlet called textField, pointing to the field in question):. Why is my UIImageView blurred?
- (void)viewWillAppear:(BOOL)animated {     [super viewWillAppear:animated];     [textField becomeFirstResponder]; } 
SHowing Activity Indicator View Using Thread Shows This Error in gdb?Unable to push notifications to iPhone in .NET - .PEM certificate problem?


What's the difference between using obj-c accessors and using dot syntax?

In Swift

To automatically show the keyboard, to the following:. UIWebView scrollBy replacement
override func viewDidLoad() {     super.viewDidLoad()      // show keyboard     textView.becomeFirstResponder() } 
Notes. Hide the tab bar when displaying the ABPeoplePickerNavigationController?
  • This assumes this the text view is editable.
  • Works for both UITextView and UITextField
  • To hide the keyboard use textView.resignFirstResponder()


Following worked fine for me using Swift.
override func viewDidAppear(animated: Bool) {     // Show keyboard by default     billField.becomeFirstResponder() } 
Key is to use the viewDidAppear function. .

88 out of 100 based on 63 user ratings 338 reviews