Answer by hstdt for How to know when text is pasted into a UITextView?
iOS 13 with Combinepublic extension UITextView { var textDidChangePublisher: AnyPublisher<String, Never> { NotificationCenter.default .publisher(for: UITextView.textDidChangeNotification, object:...
View ArticleAnswer by Lance Samaria for How to know when text is pasted into a UITextView?
This is the only way that I was able to get it to work. I used a textField but the same concept should still work for a textView.In the shouldChangeCharactersIn delegate method below I casted the...
View ArticleAnswer by Alexey Saechnikov for How to know when text is pasted into a...
textView(_, shouldChangeTextIn, replacementText) can be called in many cases. if you will read UIPasteboard.general.string value every time, user will see system alert that application accessed...
View ArticleAnswer by User18474728 for How to know when text is pasted into a UITextView?
It is for Swift5.1func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { if let paste = UIPasteboard.general.string, text == paste {...
View ArticleAnswer by Joseph Razon IL for How to know when text is pasted into a UITextView?
This is what I use to detect pasted images:- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if (UIPasteboard.generalPasteboard.image...
View ArticleAnswer by Govindharaj Murugan for How to know when text is pasted into a...
This is working Perfect inXcode 11xSwift 5x func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { if...
View ArticleAnswer by Nupur Sharma for How to know when text is pasted into a UITextView?
In SWIFT 4:func textViewDidChange(_ textView: UITextView) { if(textView.text == UIPasteboard.general.string) { //Text pasted }}
View ArticleAnswer by slboat for How to know when text is pasted into a UITextView?
try subclasses UITextview,and override this function.public override func paste(_ sender: Any?)
View ArticleAnswer by Takamitsu Mizutori for How to know when text is pasted into a...
Checking the pasteboard's string by if string == UIPasteboard.general.string takes a couple of seconds if you have long sentence in the pasteboard. The user sees the keypad is frozen while this check....
View ArticleAnswer by danielrosero for How to know when text is pasted into a UITextView?
carlos16196 was a good approach, but I would also tweak it by changing [text isEqualToString:[UIPasteboard generalPasteboard].string] to [text containsString:[UIPasteboard generalPasteboard].string]By...
View ArticleAnswer by carlos16196 for How to know when text is pasted into a UITextView?
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...
View ArticleAnswer by joseph.hainline for How to know when text is pasted into a UITextView?
Your UITextView will call its UITextViewDelegate method - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)textif a delegate has been set up....
View ArticleHow to know when text is pasted into a UITextView?
What event is fired when a block of text is pasted into a UITextView? I need to modify the frame of my textView when the text is pasted in.
View Article