开发者

Removing a Keyboard after text is entered into a TextView

I have made a text view in interface builder and when i type in my 开发者_开发知识库details into the box, clicking done doesn't minimise the keyboard.

How is this done?

Thanks


UITextView does not have any methods which will be called when the user hits the return key. If you want the user to be able to add only one line of text, use a UITextField. Hitting the return and hiding the keyboard for a UITextView does not follow the interface guidelines.

Even then if you want to do this, implement the textView:shouldChangeTextInRange:replacementText: method of UITextViewDelegate and in that check if the replacement text is \n, hide the keyboard.

http://iosdevelopertips.com/cocoa/how-to-dismiss-the-keyboard-when-using-a-uitextview.html

How to dismiss keyboard for UITextView with return key?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜