开发者

Setting UITextView's editable to NO always resigns FirstResponder. Can be avoided?

开发者 https://www.devze.com 2023-03-14 10:15 出处:网络
My app basically lets you send a piece of text. When the user taps send, I would like to disable the text view which contains the text so the user can\'t edit it anymore as the text is being sent. It

My app basically lets you send a piece of text. When the user taps send, I would like to disable the text view which contains the text so the user can't edit it anymore as the text is being sent. It seems though that setting either enableUserInteraction or editable to NO always resigns the first responder (basically the keyboard is dismissed) which is a behavior I don't want. I want to keep the keyboard displayed. Is there anyway around t开发者_JAVA技巧his? Thanks in advance.


While I don't really understand why you think it's a good idea to keep the keyboard on screen if there's nothing to edit, you can achieve this by having a hidden UITextField and making that first responder.


If the UITextView's delegate method textView:shouldChangeTextInRange:replacementText: returns NO, its contents will not be changed.

0

精彩评论

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