Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know when paste event triggered in UITextView?

I have been working on Rich text editor app in IOS.

My aim is to detect the triggering of a Paste event in UITextView, And prevent the default paste operation. Then, I'll convert content in the UIPasteboard to my Editor app format and append the converted nsattributedstring into UITextView.

I have referred the following link:

Detect when a user clicks the paste button in a UITextView.

I think solution of the problem is related to UITextField and not for UITextView(Correct me, If i'm wrong).

Thanks for your answers.

like image 957
Kirubachari Avatar asked Dec 08 '22 12:12

Kirubachari


1 Answers

I think creating a custom textview and override to paste: method will help you.

- (void)paste:(id)sender
{
    [super paste:sender];

    NSLog(@"PASTE!!");
}
like image 123
caglar Avatar answered Dec 11 '22 10:12

caglar