From a1a2d781096fdaea050ca1afb4c0bba9b0ee7a39 Mon Sep 17 00:00:00 2001 From: bellchen Date: Tue, 29 Nov 2016 10:02:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E5=9B=BE=E7=89=87=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YYKit/Text/YYTextView.h | 1 + YYKit/Text/YYTextView.m | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/YYKit/Text/YYTextView.h b/YYKit/Text/YYTextView.h index 5ffe218a..ec592e19 100644 --- a/YYKit/Text/YYTextView.h +++ b/YYKit/Text/YYTextView.h @@ -46,6 +46,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)textView:(YYTextView *)textView didTapHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect; - (BOOL)textView:(YYTextView *)textView shouldLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange; - (void)textView:(YYTextView *)textView didLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect; +- (BOOL)textView:(YYTextView *)textView customHandlePastedImage:(UIImage *)image; @end diff --git a/YYKit/Text/YYTextView.m b/YYKit/Text/YYTextView.m index 064ea88e..1ecda9e6 100644 --- a/YYKit/Text/YYTextView.m +++ b/YYKit/Text/YYTextView.m @@ -2912,6 +2912,11 @@ - (void)paste:(id)sender { img = [UIImage imageWithData:p.imageData scale:kScreenScale]; } if (img && img.size.width > 1 && img.size.height > 1) { + if ([self.delegate respondsToSelector:@selector(textView:customHandlePastedImage:)]) { + if ([self.delegate textView:self customHandlePastedImage:img]) { + return; + } + } id content = img; if ([img conformsToProtocol:@protocol(YYAnimatedImage)]) { id ani = (id)img;