Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set "User Interaction Enabled" on UITextViews in code

I have the following problem: I got a view with two text fields and a UITextView (non editable, but scrolling) to show some infos. When the keyboard is shown I slide the whole view up so both text fields and the keyboard are shown. When the user clicks outside of the text fields I hide the keyboard and move the view back down.

This works only if the user does not click on the UITextView to hide the keyboard. If I turn of "User Interaction Enabled" in IB it works but UITextView won't be scrollable.

How do I set the "User Interaction Enabled" in code so whenever the keyboard is shown I would disable it? Or is there a better way to solve this?

tia Stefan

like image 463
sliver Avatar asked Sep 07 '09 16:09

sliver


1 Answers

Set the userInteractionEnabled property:

//UITextView *textView;
textView.userInteractionEnabled = YES;
like image 164
Daniel Dickison Avatar answered Oct 05 '22 23:10

Daniel Dickison