|
@@ -33,6 +33,8 @@
|
|
|
|
|
|
#import "LEETheme.h"
|
|
|
#import "SLFriensInfoVc.h"
|
|
|
+#import "SLMikeSegment.h"
|
|
|
+#import "SLMomentsVc.h"
|
|
|
|
|
|
@interface SDTimeLineCellCommentView () <MLLinkLabelDelegate>
|
|
|
|
|
@@ -111,18 +113,17 @@
|
|
|
long originalLabelsCount = self.commentLabelsArray.count;
|
|
|
long needsToAddCount = commentItemsArray.count > originalLabelsCount ? (commentItemsArray.count - originalLabelsCount) : 0;
|
|
|
for (int i = 0; i < needsToAddCount; i++) {
|
|
|
- MLLinkLabel *label = [MLLinkLabel new];
|
|
|
+ MLLinkLabel *label = [MLLinkLabel new];
|
|
|
UIColor *highLightColor = SLColor(@"#48484A");
|
|
|
label.linkTextAttributes = @{NSForegroundColorAttributeName : highLightColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:14]};
|
|
|
label.font = [UIFont systemFontOfSize:14];
|
|
|
label.textColor = SLColor(@"#48484A");
|
|
|
label.delegate = self;
|
|
|
WS(weakSelf);
|
|
|
+ __block UILabel *blockLabel = label;
|
|
|
label.labelLongTouchBlock = ^{
|
|
|
+ [weakSelf showMsgSegmentWith:blockLabel model:self->_commentItemsArray[i]];
|
|
|
NSLog(@"didLongTouchCommentLabelBlock--%d---------commentItemsArray",i);
|
|
|
- if (weakSelf.didLongTouchCommentLabelBlock) {
|
|
|
- weakSelf.didLongTouchCommentLabelBlock(@"123", CGRectZero, [NSIndexPath indexPathForRow:self.indexPath.row inSection:i]);
|
|
|
- }
|
|
|
};
|
|
|
label.labelClickedBlock = ^{
|
|
|
NSLog(@"%d---------commentItemsArray",i);
|
|
@@ -144,6 +145,68 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void)showMsgSegmentWith:(UILabel *)bgView model:(SDTimeLineCellCommentItemModel *)commentItemModel {
|
|
|
+ UIViewController *vc = self.viewController;
|
|
|
+ if ([vc isKindOfClass:SLMomentsVc.class]) {
|
|
|
+ CGRect rect = [self convertRect:bgView.frame toView:self.viewController.view];
|
|
|
+ //加一个蒙层
|
|
|
+ __block UIView *bView = [[UIView alloc] initWithFrame:vc.view.frame];
|
|
|
+ bView.backgroundColor = [UIColor clearColor];
|
|
|
+ __block UIView *blockBgView = bView;
|
|
|
+ [bView addTapWithBlock:^{
|
|
|
+ [blockBgView removeFromSuperview];
|
|
|
+ }];
|
|
|
+ [vc.view addSubview:bView];
|
|
|
+ NSMutableArray *arr = [NSMutableArray new];
|
|
|
+
|
|
|
+ [arr addObject:[SLMikeSegmentModel initWithSegTitle: @"复制" segImage:@"" mikeType:SLMsgCopy]];
|
|
|
+ if ([self.userId isEqualToString:[SLGlobalInfo SharedInstance].loginInfo.user.userId]) {
|
|
|
+ [arr addObject:[SLMikeSegmentModel initWithSegTitle:@"删除" segImage:@"" mikeType:SLMikeInputDelete]];
|
|
|
+ }
|
|
|
+
|
|
|
+ CGFloat width = arr.count * 45 + 20;
|
|
|
+ SLMikeSegment *mikeSegment = [[SLMikeSegment alloc] initWithFrame:CGRectMake(bgView.frame.origin.x + rect.size.width / 2.0, rect.origin.y - 39, width, 30) titleArray:arr];
|
|
|
+ WS(weakSelf);
|
|
|
+ mikeSegment.mikeSegmentBlock = ^(SLMikeSegmentModel *model) {
|
|
|
+ [bView removeFromSuperview];
|
|
|
+ switch (model.mikeType) {
|
|
|
+ case SLMsgCopy:
|
|
|
+ {
|
|
|
+ [[UIPasteboard generalPasteboard] setString:commentItemModel.content];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case SLMikeInputTrans:
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case SLMikeInputDelete:
|
|
|
+ {
|
|
|
+ if (weakSelf.didLongTouchCommentLabelBlock) {
|
|
|
+ NSInteger i = [self->_commentItemsArray indexOfObject:commentItemModel];
|
|
|
+ weakSelf.didLongTouchCommentLabelBlock(@"123", CGRectZero, [NSIndexPath indexPathForRow:self.indexPath.row inSection:i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ [bView addSubview:mikeSegment];
|
|
|
+ SLMomentsVc *msgVc = (SLMomentsVc *)vc;
|
|
|
+ UIImageView *imgView = [[UIImageView alloc] initWithImage:ImageName(@"icon_dsjx")];
|
|
|
+ [bView addSubview:imgView];
|
|
|
+ [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.centerX.equalTo(mikeSegment);
|
|
|
+ make.top.equalTo(mikeSegment.mas_bottom).offset(0);
|
|
|
+ make.width.mas_equalTo(16);
|
|
|
+ make.height.mas_equalTo(8);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
- (void)setLikeItemsArray:(NSArray *)likeItemsArray
|
|
|
{
|
|
|
|