Search code examples
objective-ccocoa-touchiosuitextviewtouch-event

Get touch events in a UITextView


Apple does not provide touch event handling for UITextView. The project I'm developing includes notes that can be readable and editable, and I am using a UITextView. Please help me with this problem -- how can I get touch events for my project?


Solution

  • I resolved the issue by using my own logic.

    While reading we are adding a Custom View over the textview and working with those methods:

    (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    

    But when we are in the editing mode it is not possible anymore. Anyhow my requirement is only in readable mode.

    Thanks for all your support to resolve the issue.