我正在使用 UITextView 并希望保留 Return 键的正常用法,即插入新行。但是,当我无法使用 Return 键时,如何关闭键盘呢?
A lot of people add a UIToolbar with a Done button on it above the keyboard. This is how the Safari app does it as well and in my opinion it is the best way to handle this situation. See a pic here http://www.nwmobiledev.com/wp-content/uploads/2012/01/Screenshot_22.png.
要关闭键盘,你只需要做[textField resignFirstResponder];.
Here http://www.randomsequence.com/articles/adding-a-toolbar-with-next-previous-above-uitextfield-keyboard-iphone/是一个很好的示例,说明如何在键盘显示/隐藏时添加 UIToolbar。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)