|
@@ -358,6 +358,12 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void)msgTransHandleLongPressGestures:(UILongPressGestureRecognizer *)paramSender {
|
|
|
+ if (paramSender.state == UIGestureRecognizerStateBegan) {
|
|
|
+ [self showMsgSegmentWith:self.msgTransLabelBgView];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
- (void)showMsgSegmentWith:(UIView *)bgView {
|
|
|
UIViewController *vc = self.viewController;
|
|
|
if ([vc isKindOfClass:SLMessageViewController.class]) {
|
|
@@ -383,8 +389,8 @@
|
|
|
}
|
|
|
if (self.msgModel.isReceive) {
|
|
|
[arr insertObject:[SLMikeSegmentModel initWithSegTitle: @"播放" segImage:@"icon_filled_talk" mikeType:SLMikeInputBroadcast] atIndex:0];
|
|
|
- [arr addObject:[SLMikeSegmentModel initWithSegTitle: @"复制" segImage:@"icon_mike_copy" mikeType:SLMsgCopy]];
|
|
|
}
|
|
|
+ [arr addObject:[SLMikeSegmentModel initWithSegTitle: @"复制" segImage:@"icon_mike_copy" mikeType:SLMsgCopy]];
|
|
|
}else if (self.msgModel.showMike && self.msgModel.showText) {
|
|
|
if (bgView == self.mikeLabelBgView) {
|
|
|
[arr addObject:[SLMikeSegmentModel initWithSegTitle:@"删除" segImage:@"icon_mike_delete" mikeType:SLMikeInputDelete]];
|
|
@@ -394,11 +400,13 @@
|
|
|
}
|
|
|
if (bgView == self.messageLabelBgView) {
|
|
|
[arr addObject:[SLMikeSegmentModel initWithSegTitle:@"隐藏" segImage:@"icon_mike_delete" mikeType:SLMikeInputHidden]];
|
|
|
- if (self.msgModel.isReceive) {
|
|
|
- [arr addObject:[SLMikeSegmentModel initWithSegTitle: @"复制" segImage:@"icon_mike_copy" mikeType:SLMsgCopy]];
|
|
|
- }
|
|
|
+ [arr addObject:[SLMikeSegmentModel initWithSegTitle: @"复制" segImage:@"icon_mike_copy" mikeType:SLMsgCopy]];
|
|
|
}
|
|
|
}
|
|
|
+ if (self.msgModel.showTrans && bgView == self.msgTransLabelBgView) {
|
|
|
+ [arr removeAllObjects];
|
|
|
+ [arr addObject:[SLMikeSegmentModel initWithSegTitle: @"复制" segImage:@"icon_mike_copy" mikeType:SLMsgCopy]];
|
|
|
+ }
|
|
|
|
|
|
CGFloat width = arr.count * 45 + 20;
|
|
|
CGFloat x = self.msgModel.isReceive ? rect.origin.x : rect.origin.x + rect.size.width - width;
|
|
@@ -474,9 +482,9 @@
|
|
|
_msgTransLabelBgView.backgroundColor = [UIColor whiteColor];
|
|
|
_msgTransLabelBgView.clipsToBounds = YES;
|
|
|
_msgTransLabelBgView.userInteractionEnabled = YES;
|
|
|
-// UILongPressGestureRecognizer *gesture=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(msgHandleLongPressGestures:)];
|
|
|
-// gesture.minimumPressDuration= 0.5f;
|
|
|
-// [_msgTransLabelBgView addGestureRecognizer:gesture];
|
|
|
+ UILongPressGestureRecognizer *gesture=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(msgTransHandleLongPressGestures:)];
|
|
|
+ gesture.minimumPressDuration= 0.5f;
|
|
|
+ [_msgTransLabelBgView addGestureRecognizer:gesture];
|
|
|
[self.contentView addSubview:_msgTransLabelBgView];
|
|
|
}
|
|
|
return _msgTransLabelBgView;
|