ios/swift - 强制键盘跟上 uitextview?

ios/swift - force keyboard to stay up with uitextview?

假设我在 iPhone 上有一个消息传递应用程序,每次我单击 "Send" 按钮发送消息时,我不希望键盘 "hide",我想让它留在原地。有什么办法吗?我试过使用 textViewShouldEndEditing 来调整它,但即使它 returns false,键盘仍然隐藏。我也试过在 textViewShouldEndEditing 函数中使用 textView.becomeFirstResponder() ,但我不确定把它放在哪里。请帮忙,谢谢!

没关系,我明白了!我将 textView.becomeFirstResponder() 放在发送按钮的 IBOutlet 中而不是 textViewShouldEndEditing 函数中。

textView.delegate = self;
-(BOOL)textViewShouldEndEditing:(UITextView *)textView{return No;}