views:

416

answers:

1

HI, Apple not providing touch events for UI-text View, im developing project includes notes, that can readable ,editable, can give color to selected text. for that i chosen UI-text View because it can readable as well as editable. to do some events on text of UI-text view need touch events ,but Apple not providing touch events for UI-text view. so please help me regarding this problem how to get touch event for my project in this scenario.

Thanks in advance

+1  A: 

According to the Apple documentation, you may set a delegate for UITextView and implement the UITextViewDelegate.

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html

Specifically, you can determine that a UITextView was touched by implementing textViewShouldBeginEditing.

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView;

Be sure to set the delegate property on the UITextView in order to catch the event.

Kevin Elliott
thanks for response- (BOOL)textViewShouldBeginEditing:(UITextView *)textView;these method will call only when [textView seteditable:yes]; but if i want to change color of some text background i must disable the editing. and please let me know how to insert image at certain place in ui-textview. please if possible post some reliable code hereThanks in advance
maddy
You do not need to disable the editing in order to change the background!Also, you could always wrap the UITextView in a custom UIView, and catch touch events on that (using a delegate as necessary). I do this to catch touch events on MKMapView with ease. This is a great approach, and will not compromise your UITextViewDelegate methods.
Kevin Elliott