How do I show the keyboard by default in UITextView?

后端 未结 3 1045
遇见更好的自我
遇见更好的自我 2020-12-23 20:20

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

3条回答
  •  独厮守ぢ
    2020-12-23 21:06

    to accomplish that just send the becomeFirstResponder message to your UITextField, as follows (assuming you have an outlet called textField, pointing to the field in question):

    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        [textField becomeFirstResponder];
    }
    

提交回复
热议问题