問題:
In IB's library, the introduction tells us that when the return key is pressed, the keyboard for UITextView
will disappear.在IB的庫中,介紹告訴我們,當按下回車鍵時, UITextView
的鍵盤就會消失。 But actually the return key can only act as '\\n'.但實際上返回鍵只能充當'\\n'。
I can add a button and use [txtView resignFirstResponder]
to hide the keyboard.我可以添加一個按鈕並使用[txtView resignFirstResponder]
來隱藏鍵盤。
But is there a way to add the action for the return key in keyboard so that I needn't add UIButton
?但是有沒有辦法在鍵盤中添加返回鍵的動作,這樣我就不需要添加UIButton
?
解決方案:
參考一: https://en.stackoom.com/question/2x4s參考二: https://stackoom.com/question/2x4s