How do I show the keyboard by default in UITextView?

后端 未结 3 1049
遇见更好的自我
遇见更好的自我 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:01

    Following worked fine for me using Swift

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
    
        // Show keyboard by default
        billField.becomeFirstResponder()
    }
    

    Key is to use the viewDidAppear function.

提交回复
热议问题