Skip to content

Commit 2f65223

Browse files
committed
添加复制功能的保护
1 parent fb6a444 commit 2f65223

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

MessageDisplayKit/Classes/Views/MessageContentViews/XHMessageTableViewCell.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ - (void)longPressGestureRecognizerHandle:(UILongPressGestureRecognizer *)longPre
280280
SEL action = nil;
281281
switch (i) {
282282
case 0: {
283-
action = @selector(copyed:);
283+
if ([self.messageBubbleView.message messageMediaType] == XHBubbleMessageMediaTypeText) {
284+
action = @selector(copyed:);
285+
}
284286
break;
285287
}
286288
case 1: {
@@ -298,9 +300,11 @@ - (void)longPressGestureRecognizerHandle:(UILongPressGestureRecognizer *)longPre
298300
default:
299301
break;
300302
}
301-
UIMenuItem *item = [[UIMenuItem alloc] initWithTitle:title action:action];
302-
if (item) {
303-
[menuItems addObject:item];
303+
if (action) {
304+
UIMenuItem *item = [[UIMenuItem alloc] initWithTitle:title action:action];
305+
if (item) {
306+
[menuItems addObject:item];
307+
}
304308
}
305309
}
306310

0 commit comments

Comments
 (0)