Browse Source

朋友圈部分优化

桂欢 2 years ago
parent
commit
b7266cc11d

+ 22 - 0
SLAiELTS/SLAiELTS/Assets.xcassets/Moents/icon_heart.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "icon_heart@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "icon_heart@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Moents/icon_heart.imageset/icon_heart@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Moents/icon_heart.imageset/icon_heart@3x.png


+ 22 - 0
SLAiELTS/SLAiELTS/Assets.xcassets/Moents/icon_moents_chat.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "icon_moents_chat@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "icon_moents_chat@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Moents/icon_moents_chat.imageset/icon_moents_chat@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Moents/icon_moents_chat.imageset/icon_moents_chat@3x.png


+ 12 - 15
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/TimeLineController/SDTimeLineTableViewController.m

@@ -124,10 +124,7 @@ static CGFloat textFieldH = 40;
     self.tableView.tableHeaderView = headerView;
     
     //添加分隔线颜色设置
-    
-    self.tableView.lee_theme
-    .LeeAddSeparatorColor(DAY , [[UIColor lightGrayColor] colorWithAlphaComponent:0.5f])
-    .LeeAddSeparatorColor(NIGHT , [[UIColor grayColor] colorWithAlphaComponent:0.5f]);
+    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
 
     [self.tableView registerClass:[SDTimeLineCell class] forCellReuseIdentifier:kTimeLineTableViewCellId];
 
@@ -228,11 +225,11 @@ static CGFloat textFieldH = 40;
 
 - (NSArray *)creatModelsWithCount:(NSInteger)count
 {
-    NSArray *iconImageNamesArray = @[@"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
+    NSArray *iconImageNamesArray = @[@"icon_ellipse.jpg",
+                                     @"icon_ellipse.jpg",
+                                     @"icon_ellipse.jpg",
+                                     @"icon_ellipse.jpg",
+                                     @"icon_ellipse.jpg",
                                      ];
     
     NSArray *namesArray = @[@"GSD_iOS",
@@ -262,15 +259,15 @@ static CGFloat textFieldH = 40;
                                @"我勒个去,啥世道啊",
                                @"真有意思啊你💢💢💢"];
     
-    NSArray *picImageNamesArray = @[ @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg",
+    NSArray *picImageNamesArray = @[ @"icon_home_zysj.jpg",
+                                     @"icon_home_yx.jpg",
+                                     @"icon_home_zysj.jpg",
                                      @"icon_lx_ts_ky.jpg",
+                                     @"icon_home_jq.jpg",
                                      @"icon_lx_ts_ky.jpg",
+                                     @"icon_home_yx.jpg",
                                      @"icon_lx_ts_ky.jpg",
-                                     @"icon_lx_ts_ky.jpg"
+                                     @"icon_home_jq.jpg"
                                      ];
     NSMutableArray *resArr = [NSMutableArray new];
     

+ 74 - 42
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/Cell/SDTimeLineCell.m

@@ -39,7 +39,7 @@
 
 #import "LEETheme.h"
 
-const CGFloat contentLabelFontSize = 15;
+const CGFloat contentLabelFontSize = 14;
 CGFloat maxContentLabelHeight = 0; // 根据具体font而定
 
 NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLineCellOperationButtonClickedNotification";
@@ -54,6 +54,8 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
     UILabel *_timeLabel;
     UIButton *_moreButton;
     UIButton *_operationButton;
+    UIButton *_operationLikeButton;
+    UIButton *_operationCommentButton;
     SDTimeLineCellCommentView *_commentView;
     SDTimeLineCellOperationMenu *_operationMenu;
 }
@@ -81,8 +83,8 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
     _iconView = [UIImageView new];
     
     _nameLable = [UILabel new];
-    _nameLable.font = [UIFont systemFontOfSize:14];
-    _nameLable.textColor = [UIColor colorWithRed:(54 / 255.0) green:(71 / 255.0) blue:(121 / 255.0) alpha:0.9];
+    _nameLable.font = [UIFont boldSystemFontOfSize:16];
+    _nameLable.textColor = SLColor(@"#080F1B");
     
     _contentLabel = [UILabel new];
     _contentLabel.font = [UIFont systemFontOfSize:contentLabelFontSize];
@@ -98,54 +100,78 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
     _moreButton.titleLabel.font = [UIFont systemFontOfSize:14];
     
     _operationButton = [UIButton new];
-    [_operationButton setImage:[UIImage imageNamed:@"icon_lx_ts_ky"] forState:UIControlStateNormal];
+    [_operationButton setImage:[UIImage imageNamed:@"icon_moents_chat"] forState:UIControlStateNormal];
     [_operationButton addTarget:self action:@selector(operationButtonClicked) forControlEvents:UIControlEventTouchUpInside];
     
-    _picContainerView = [SDWeiXinPhotoContainerView new];
-    
-    _commentView = [SDTimeLineCellCommentView new];
-    
-    _timeLabel = [UILabel new];
-    _timeLabel.font = [UIFont systemFontOfSize:13];
-    
-    
-    _operationMenu = [SDTimeLineCellOperationMenu new];
-    __weak typeof(self) weakSelf = self;
-    [_operationMenu setLikeButtonClickedOperation:^{
+    _operationLikeButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    [_operationLikeButton setTitle:@"点赞" forState:UIControlStateNormal];
+    _operationLikeButton.titleLabel.font = [UIFont systemFontOfSize:10];
+    [_operationLikeButton setTitleColor:SLColor(@"#8E8E93") forState:UIControlStateNormal];
+    [_operationLikeButton setImage:[UIImage imageNamed:@"icon_heart"] forState:UIControlStateNormal];
+    WS(weakSelf);
+    [_operationLikeButton handleEvent:UIControlEventTouchUpInside withBlock:^{
         if ([weakSelf.delegate respondsToSelector:@selector(didClickLikeButtonInCell:)]) {
             [weakSelf.delegate didClickLikeButtonInCell:weakSelf];
         }
     }];
-    [_operationMenu setCommentButtonClickedOperation:^{
+
+    _operationCommentButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    [_operationCommentButton setTitle:@"评论" forState:UIControlStateNormal];
+    _operationCommentButton.titleLabel.font = [UIFont systemFontOfSize:10];
+    [_operationCommentButton setTitleColor:SLColor(@"#8E8E93") forState:UIControlStateNormal];
+    [_operationCommentButton setImage:[UIImage imageNamed:@"icon_moents_chat"] forState:UIControlStateNormal];
+    [_operationCommentButton handleEvent:UIControlEventTouchUpInside withBlock:^{
         if ([weakSelf.delegate respondsToSelector:@selector(didClickcCommentButtonInCell:)]) {
             [weakSelf.delegate didClickcCommentButtonInCell:weakSelf];
         }
     }];
     
     
-    NSArray *views = @[_iconView, _nameLable, _contentLabel, _moreButton, _picContainerView, _timeLabel, _operationButton, _operationMenu, _commentView];
+    _picContainerView = [SDWeiXinPhotoContainerView new];
+    
+    _commentView = [SDTimeLineCellCommentView new];
+    
+    _timeLabel = [UILabel new];
+    _timeLabel.textColor = SLColor(@"#8E8E93");
+    _timeLabel.font = [UIFont systemFontOfSize:10];
+    
+    
+//    _operationMenu = [SDTimeLineCellOperationMenu new];
+//    __weak typeof(self) weakSelf = self;
+//    [_operationMenu setLikeButtonClickedOperation:^{
+//        if ([weakSelf.delegate respondsToSelector:@selector(didClickLikeButtonInCell:)]) {
+//            [weakSelf.delegate didClickLikeButtonInCell:weakSelf];
+//        }
+//    }];
+//    [_operationMenu setCommentButtonClickedOperation:^{
+//        if ([weakSelf.delegate respondsToSelector:@selector(didClickcCommentButtonInCell:)]) {
+//            [weakSelf.delegate didClickcCommentButtonInCell:weakSelf];
+//        }
+//    }];
+    
+    
+    NSArray *views = @[_iconView, _nameLable, _contentLabel, _moreButton, _picContainerView, _timeLabel, _operationLikeButton, _operationCommentButton, _commentView];
     
     [self.contentView sd_addSubviews:views];
     
     UIView *contentView = self.contentView;
-    CGFloat margin = 10;
     
     _iconView.sd_layout
-    .leftSpaceToView(contentView, margin)
-    .topSpaceToView(contentView, margin + 5)
-    .widthIs(40)
-    .heightIs(40);
+    .leftSpaceToView(contentView, 14)
+    .topSpaceToView(contentView, 8)
+    .widthIs(48)
+    .heightIs(48);
     
     _nameLable.sd_layout
-    .leftSpaceToView(_iconView, margin)
+    .leftSpaceToView(_iconView, 12)
     .topEqualToView(_iconView)
-    .heightIs(18);
+    .heightIs(24);
     [_nameLable setSingleLineAutoResizeWithMaxWidth:200];
     
     _contentLabel.sd_layout
     .leftEqualToView(_nameLable)
-    .topSpaceToView(_nameLable, margin)
-    .rightSpaceToView(contentView, margin)
+    .topSpaceToView(_nameLable, 3)
+    .rightSpaceToView(contentView, 12)
     .autoHeightRatio(0);
     
     // morebutton的高度在setmodel里面设置
@@ -160,26 +186,32 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
     
     _timeLabel.sd_layout
     .leftEqualToView(_contentLabel)
-    .topSpaceToView(_picContainerView, margin)
-    .heightIs(15);
+    .topSpaceToView(_picContainerView, 8)
+    .heightIs(16);
     [_timeLabel setSingleLineAutoResizeWithMaxWidth:200];
     
-    _operationButton.sd_layout
-    .rightSpaceToView(contentView, margin)
+    _operationLikeButton.sd_layout
+    .rightSpaceToView(contentView, 14)
     .centerYEqualToView(_timeLabel)
-    .heightIs(25)
-    .widthIs(25);
+    .heightIs(16)
+    .widthIs(40);
+    
+    _operationCommentButton.sd_layout
+    .rightSpaceToView(_operationLikeButton, 8)
+    .centerYEqualToView(_timeLabel)
+    .heightIs(16)
+    .widthIs(40);
     
     _commentView.sd_layout
     .leftEqualToView(_contentLabel)
-    .rightSpaceToView(self.contentView, margin)
-    .topSpaceToView(_timeLabel, margin); // 已经在内部实现高度自适应所以不需要再设置高度
-    
-    _operationMenu.sd_layout
-    .rightSpaceToView(_operationButton, 0)
-    .heightIs(36)
-    .centerYEqualToView(_operationButton)
-    .widthIs(0);
+    .rightSpaceToView(self.contentView, 14)
+    .topSpaceToView(_timeLabel, 4); // 已经在内部实现高度自适应所以不需要再设置高度
+    
+//    _operationMenu.sd_layout
+//    .rightSpaceToView(_operationButton, 0)
+//    .heightIs(36)
+//    .centerYEqualToView(_operationButton)
+//    .widthIs(0);
 }
 
 - (void)configTheme{
@@ -192,8 +224,8 @@ NSString *const kSDTimeLineCellOperationButtonClickedNotification = @"SDTimeLine
     .LeeAddTextColor(NIGHT , [UIColor grayColor]);
 
     _timeLabel.lee_theme
-    .LeeAddTextColor(DAY , [UIColor lightGrayColor])
-    .LeeAddTextColor(NIGHT , [UIColor grayColor]);
+    .LeeAddTextColor(DAY , SLColor(@"#8E8E93"))
+    .LeeAddTextColor(NIGHT , SLColor(@"#8E8E93"));
 }
 
 - (void)dealloc

+ 22 - 20
SLAiELTS/SLAiELTS/ViewControllers/TimeLine/Views/CommentView/SDTimeLineCellCommentView.m

@@ -68,16 +68,18 @@
     _bgImageView = [UIImageView new];
     UIImage *bgImage = [[[UIImage imageNamed:@"LikeCmtBg"] stretchableImageWithLeftCapWidth:40 topCapHeight:30] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
     _bgImageView.image = bgImage;
-    _bgImageView.backgroundColor = [UIColor clearColor];
+    _bgImageView.backgroundColor = SLColor(@"#F5F8F7");
     [self addSubview:_bgImageView];
     
     _likeLabel = [MLLinkLabel new];
-    _likeLabel.font = [UIFont systemFontOfSize:14];
-    _likeLabel.linkTextAttributes = @{NSForegroundColorAttributeName : TimeLineCellHighlightedColor};
+    _likeLabel.font = [UIFont systemFontOfSize:12];
+    _likeLabel.linkTextAttributes = @{NSForegroundColorAttributeName : SLColor(@"#384962")};
     _likeLabel.isAttributedContent = YES;
+    _likeLabel.backgroundColor = SLColor(@"#F5F8F7");
     [self addSubview:_likeLabel];
     
     _likeLableBottomLine = [UIView new];
+    _likeLableBottomLine.backgroundColor = [UIColor whiteColor];
     [self addSubview:_likeLableBottomLine];
     
     _bgImageView.sd_layout.spaceToSuperView(UIEdgeInsetsMake(0, 0, 0, 0));
@@ -86,7 +88,7 @@
 - (void)configTheme{
     
     self.lee_theme
-    .LeeAddBackgroundColor(DAY , [UIColor whiteColor])
+    .LeeAddBackgroundColor(DAY , SLColor(@"#F5F8F7"))
     .LeeAddBackgroundColor(NIGHT , [UIColor blackColor]);
     
     _bgImageView.lee_theme
@@ -94,7 +96,7 @@
     .LeeAddTintColor(NIGHT , SDColor(30, 30, 30, 1.0f));
     
     _likeLabel.lee_theme
-    .LeeAddTextColor(DAY , [UIColor blackColor])
+    .LeeAddTextColor(DAY , SLColor(@"#384962"))
     .LeeAddTextColor(NIGHT , [UIColor grayColor]);
     
     _likeLableBottomLine.lee_theme
@@ -106,17 +108,15 @@
 - (void)setCommentItemsArray:(NSArray *)commentItemsArray
 {
     _commentItemsArray = commentItemsArray;
-    
+
     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];
-        UIColor *highLightColor = TimeLineCellHighlightedColor;
-        label.linkTextAttributes = @{NSForegroundColorAttributeName : highLightColor};
-        label.lee_theme
-        .LeeAddTextColor(DAY , [UIColor blackColor])
-        .LeeAddTextColor(NIGHT , [UIColor grayColor]);
-        label.font = [UIFont systemFontOfSize:14];
+        UIColor *highLightColor = SLColor(@"#48484A");
+        label.linkTextAttributes = @{NSForegroundColorAttributeName : highLightColor, NSFontAttributeName: [UIFont boldSystemFontOfSize:12]};
+        label.font = [UIFont systemFontOfSize:12];
+        label.textColor = SLColor(@"#48484A");
         label.delegate = self;
         [self addSubview:label];
         [self.commentLabelsArray addObject:label];
@@ -135,9 +135,8 @@
 - (void)setLikeItemsArray:(NSArray *)likeItemsArray
 {
     _likeItemsArray = likeItemsArray;
-    
     NSTextAttachment *attach = [NSTextAttachment new];
-    attach.image = [UIImage imageNamed:@"Like"];
+    attach.image = [UIImage imageNamed:@"icon_heart"];
     attach.bounds = CGRectMake(0, -3, 16, 16);
     NSAttributedString *likeIcon = [NSAttributedString attributedStringWithAttachment:attach];
     
@@ -145,6 +144,9 @@
     
     for (int i = 0; i < likeItemsArray.count; i++) {
         SDTimeLineCellLikeItemModel *model = likeItemsArray[i];
+        if (i == 0) {
+            [attributedText appendAttributedString:[[NSAttributedString alloc] initWithString:@"  "]];
+        }
         if (i > 0) {
             [attributedText appendAttributedString:[[NSAttributedString alloc] initWithString:@","]];
         }
@@ -186,7 +188,7 @@
         self.fixedWidth = nil; // 取消固定高度约束
     }
     
-    CGFloat margin = 5;
+    CGFloat margin = 0;
     
     UIView *lastTopView = nil;
     
@@ -194,7 +196,7 @@
         _likeLabel.sd_resetLayout
         .leftSpaceToView(self, margin)
         .rightSpaceToView(self, margin)
-        .topSpaceToView(lastTopView, 10)
+        .topSpaceToView(lastTopView, 3)
         .autoHeightRatio(0);
         
         lastTopView = _likeLabel;
@@ -209,8 +211,8 @@
         _likeLableBottomLine.sd_resetLayout
         .leftSpaceToView(self, 0)
         .rightSpaceToView(self, 0)
-        .heightIs(1)
-        .topSpaceToView(lastTopView, 3);
+        .heightIs(5)
+        .topSpaceToView(_likeLabel, 3);
         
         lastTopView = _likeLableBottomLine;
     } else {
@@ -245,7 +247,7 @@
 {
     NSString *text = model.firstUserName;
     if (model.secondUserName.length) {
-        text = [text stringByAppendingString:[NSString stringWithFormat:@"回复%@", model.secondUserName]];
+        text = [text stringByAppendingString:[NSString stringWithFormat:@" 回复 %@", model.secondUserName]];
     }
     text = [text stringByAppendingString:[NSString stringWithFormat:@":%@", model.commentString]];
     NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:text];
@@ -260,7 +262,7 @@
 {
     NSString *text = model.userName;
     NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:text];
-    UIColor *highLightColor = [UIColor blueColor];
+    UIColor *highLightColor = SLColor(@"#384962");
     [attString setAttributes:@{NSForegroundColorAttributeName : highLightColor, NSLinkAttributeName : model.userId} range:[text rangeOfString:model.userName]];
     
     return attString;