Quantcast
Channel: How to know when text is pasted into a UITextView? - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by carlos16196 for How to know when text is pasted into a UITextView?

$
0
0

Here is what i use to detect paste events in UITextView:

 // Set this class to be the delegate of the UITextView. Now when a user will paste a text in that textview, this delegate will be called.-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {    // Here we check if the replacement text is equal to the string we are currently holding in the paste board    if ([text isEqualToString:[UIPasteboard generalPasteboard].string]) {        // code to execute in case user is using paste    } else {        // code to execute other wise    }    return YES;}

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>