Ios – Make UITextView react to tap event. (iphone)

cocoa-touchiosiphoneobjective c

I'm trying to implemet a scrollable Text view (not editable) that display some help information etc. and when the user is done with it all he has to do is tap it and it will disapear/hidden and the user will be back in the main screen.

The UITextview not reacting to tap event (or i'm not sure how to make it react to the tap event).
Any idea how to implement this ?

I also tried to put it inside a transparent button so i can capture the tap but then i cannot scroll the text view as it seem to be behinde the button.

i'm new to iphone , any help… gr8

Thanks

Best Answer

How about adding a tap gesture recognizer to the text view?

UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(textViewTapped:)];
[yourTextView addGestureRecognizer:gestureRecognizer];