views:

586

answers:

1

I display a UITextView that I want the user to be able to copy from but not edit. There must be no keyboard present on the screen during the copy.

If I prevent first responder then the keyboard stays hidden. However this also prevents processing of events from touches that would allow a copy interaction. It also has to be editable to process touches as far as I know.

Is there an easy way to achieve this; a read-only, copy-only, no-keyboard UITextView? The docs are very terse on what "editable" guarantees, requires, and how is changes behavior.

+4  A: 

Have you tried setEditable: NO? I know you say the docs don't describe it much, but they do say that it controls whether the receiver is editable. Did you try?

You've tried that, and the answer is to set editable to NO.

Graham Lee
This is interesting. If I make the UITextView NON-editable (and do not override acceptsFirstResponder) it does the right thing: no keyboard, copyable, no pasting. Under 2.2 I had fun making the view handle touches without the keyboard coming up, but was able to throw that code away with 3.0.
Steve Weller