how to disable uikeyboard of textview ,if the edit

2019-02-25 00:44发布

问题:

How to hide/disable keyboard ,if the textview editing is enabled.

I only want to that user can only be able to select the text and can't be allowed for entering text.

Because selected text will be converted in to image for move animation.

User will not be allowed for entering any text in textview so that's why keyboard should be hidden or disable ,he will be allowed only for text selection.

回答1:

uitextview.editable = NO; or set checkmark in IB. It will allow to select text with options - Copy and Select All without keyboard appearing. Tap on the word and hold to select text.



回答2:

ok just uncheck the behavior of you UItextview in .xib file.



回答3:

Something to try it the 'editable' setting doesn't work out is to create a UIView that's hidden and out of the way somewhere and assign it as the inputView for the text view. If that property is non-nil, the view it contains will be shown instead of the keyboard.

Such as:

self.textView.inputView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)] autorelease];


回答4:

try this

yourtextview.UserinterationEnable=No;



回答5:

This will make the keyboard disappear:

[[[UIApplication sharedApplication] keyWindow] endEditing:YES];

This what you want to do?