Commit 25e3e04b84b58c9b1b7777de272971f514cafefc

Authored by 王军波
1 parent 03d2b370

解决首页tableview展示问题,评论点赞按钮复用问题

LiveVideoCloud.xcodeproj/project.pbxproj
... ... @@ -225,6 +225,7 @@
225 225 D25BF8A01E80C4BD007FB138 /* UIImage+LVCVagueImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D25BF89F1E80C4BD007FB138 /* UIImage+LVCVagueImage.m */; };
226 226 D25BF8A31E80C4FC007FB138 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D25BF8A21E80C4FC007FB138 /* Accelerate.framework */; };
227 227 D25BF8A51E80EC76007FB138 /* 头像.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D25BF8A41E80EC76007FB138 /* 头像.jpg */; };
  228 + D260E6101F0CE8690095E49D /* praiseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D260E60F1F0CE8690095E49D /* praiseModel.m */; };
228 229 D2888D941E6EB8B4003A77C8 /* LVCTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */; };
229 230 D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D9B1E6EBF1B003A77C8 /* LVCLiveViewController.m */; };
230 231 D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */; };
... ... @@ -748,6 +749,8 @@
748 749 D25BF89F1E80C4BD007FB138 /* UIImage+LVCVagueImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+LVCVagueImage.m"; sourceTree = "<group>"; };
749 750 D25BF8A21E80C4FC007FB138 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
750 751 D25BF8A41E80EC76007FB138 /* 头像.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "头像.jpg"; sourceTree = "<group>"; };
  752 + D260E60E1F0CE8690095E49D /* praiseModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = praiseModel.h; sourceTree = "<group>"; };
  753 + D260E60F1F0CE8690095E49D /* praiseModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = praiseModel.m; sourceTree = "<group>"; };
751 754 D2888D921E6EB8B4003A77C8 /* LVCTabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTabBar.h; sourceTree = "<group>"; };
752 755 D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTabBar.m; sourceTree = "<group>"; };
753 756 D2888D9A1E6EBF1B003A77C8 /* LVCLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveViewController.h; sourceTree = "<group>"; };
... ... @@ -1178,6 +1181,8 @@
1178 1181 81A482FC1E88B0130097A80A /* Model */ = {
1179 1182 isa = PBXGroup;
1180 1183 children = (
  1184 + D260E60E1F0CE8690095E49D /* praiseModel.h */,
  1185 + D260E60F1F0CE8690095E49D /* praiseModel.m */,
1181 1186 D2C6A8BD1F04998D00543EFA /* LVCVodListModel.h */,
1182 1187 D2C6A8BE1F04998D00543EFA /* LVCVodListModel.m */,
1183 1188 );
... ... @@ -2330,6 +2335,7 @@
2330 2335 D2575C7E1E76A4F300E3A8FC /* NHPlaneViews.m in Sources */,
2331 2336 4B45CE761EB86A590079AFB7 /* BeingAnchorController.m in Sources */,
2332 2337 D2029CC51E6EADE10027CD92 /* UIView+WebCacheOperation.m in Sources */,
  2338 + D260E6101F0CE8690095E49D /* praiseModel.m in Sources */,
2333 2339 D2029CAB1E6EADE10027CD92 /* MJRefreshBackNormalFooter.m in Sources */,
2334 2340 4B45CEA61EB86B9F0079AFB7 /* NSNumber+ScaleHeight.m in Sources */,
2335 2341 810B65031E779B1F00133E15 /* MASViewConstraint.m in Sources */,
... ... @@ -2618,6 +2624,7 @@
2618 2624 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
2619 2625 ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
2620 2626 CLANG_ENABLE_OBJC_WEAK = YES;
  2627 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2621 2628 DEVELOPMENT_TEAM = 94X49GG3ZW;
2622 2629 ENABLE_BITCODE = NO;
2623 2630 FRAMEWORK_SEARCH_PATHS = (
... ... @@ -2647,6 +2654,7 @@
2647 2654 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
2648 2655 ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
2649 2656 CLANG_ENABLE_OBJC_WEAK = YES;
  2657 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2650 2658 DEVELOPMENT_TEAM = 94X49GG3ZW;
2651 2659 ENABLE_BITCODE = NO;
2652 2660 FRAMEWORK_SEARCH_PATHS = (
... ...
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCVodPlayerListController.m
... ... @@ -28,6 +28,12 @@ static NSString *vodCellId = @&quot;vodCellId&quot;;
28 28  
29 29 @implementation LVCVodPlayerListController
30 30  
  31 +- (void)viewWillAppear:(BOOL)animated {
  32 + [super viewWillAppear:animated];
  33 + self.edgesForExtendedLayout = UIRectEdgeNone;
  34 + self.navigationController.navigationBar.hidden = NO;
  35 +}
  36 +
31 37 - (void)viewDidLoad {
32 38 [super viewDidLoad];
33 39  
... ... @@ -135,7 +141,7 @@ static NSString *vodCellId = @&quot;vodCellId&quot;;
135 141 - (UITableView *)tableView {
136 142  
137 143 if (!_tableView) {
138   - _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - 50) style:UITableViewStylePlain];
  144 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - 50-64) style:UITableViewStylePlain];
139 145 _tableView.dataSource = self;
140 146 _tableView.delegate = self;
141 147 _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
... ...
LiveVideoCloud/Classes/Sections/homeSections/Model/praiseModel.h 0 → 100644
  1 +//
  2 +// praiseModel.h
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/6/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface praiseModel : NSObject
  12 +
  13 +@property (nonatomic, assign) BOOL isPraised;
  14 +
  15 +@end
... ...
LiveVideoCloud/Classes/Sections/homeSections/Model/praiseModel.m 0 → 100644
  1 +//
  2 +// praiseModel.m
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/6/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "praiseModel.h"
  10 +
  11 +@implementation praiseModel
  12 +
  13 +@end
... ...
LiveVideoCloud/Classes/Sections/homeSections/View/LVCCommentCell.h
... ... @@ -7,9 +7,12 @@
7 7 //
8 8  
9 9 #import <UIKit/UIKit.h>
  10 +#import "praiseModel.h"
10 11  
11 12 @interface LVCCommentCell : UITableViewCell
12 13  
13 14 @property (nonatomic, strong) CNLiveCommentDetailInfoResult *result;
14 15  
  16 +@property (nonatomic, strong) praiseModel *praiseModel;
  17 +
15 18 @end
... ...
LiveVideoCloud/Classes/Sections/homeSections/View/LVCCommentCell.m
... ... @@ -49,6 +49,16 @@
49 49 [_likeButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -60, 0, 0)];
50 50 }
51 51  
  52 +- (void)setPraiseModel:(praiseModel *)praiseModel {
  53 +
  54 + if (_praiseModel != praiseModel) {
  55 + _praiseModel = praiseModel;
  56 + }
  57 + BOOL isSelected = praiseModel.isPraised;
  58 + _likeButton.selected = isSelected;
  59 + [_likeButton setUserInteractionEnabled:!isSelected];
  60 +}
  61 +
52 62 #pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
53 63 - (void)praiseAction:(UIButton *)btn {
54 64  
... ... @@ -59,6 +69,7 @@
59 69 NSLog(@"success");
60 70 btn.selected = YES;
61 71 [btn setUserInteractionEnabled:NO];
  72 + _praiseModel.isPraised = YES;
62 73 _result.praise = [NSString stringWithFormat:@"%ld",[_result.praise integerValue] + 1];
63 74 [_likeButton setTitle:_result.praise forState:UIControlStateNormal];
64 75  
... ...
LiveVideoCloud/Classes/Sections/homeSections/View/LVCCommentView.m
... ... @@ -18,6 +18,7 @@ static NSString *commentCellId = @&quot;commentCellId&quot;;
18 18 NSArray *_commentArray;
19 19 CGFloat _desHeight;
20 20 NSMutableArray *_cellHeightArrayM;
  21 + NSMutableArray *_praiseArrayM;
21 22 }
22 23  
23 24 @property (nonatomic, strong) UITableView *tableview;
... ... @@ -37,6 +38,7 @@ static NSString *commentCellId = @&quot;commentCellId&quot;;
37 38 if (self) {
38 39 _commentArray = [[NSArray alloc] init];
39 40 _cellHeightArrayM = [[NSMutableArray alloc] init];
  41 + _praiseArrayM = [[NSMutableArray alloc] init];
40 42 [self addNotification];
41 43 [self addSubview:self.tableview];
42 44 }
... ... @@ -66,6 +68,8 @@ static NSString *commentCellId = @&quot;commentCellId&quot;;
66 68 _commentArray = result.comments;
67 69 if (_commentArray && _commentArray.count > 0) {
68 70 for (CNLiveCommentDetailInfoResult *result in _commentArray) {
  71 + praiseModel *model = [[praiseModel alloc] init];
  72 + [_praiseArrayM addObject:model];
69 73 if (result.content) {
70 74 CGRect contentRect = [result.content boundingRectWithSize:CGSizeMake(KScreenWidth-20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil];
71 75 CGFloat contentHeight = contentRect.size.height;
... ... @@ -129,6 +133,7 @@ static NSString *commentCellId = @&quot;commentCellId&quot;;
129 133 LVCCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:commentCellId forIndexPath:indexPath];
130 134 cell.selectionStyle = UITableViewCellSelectionStyleNone;
131 135 cell.result = _commentArray[indexPath.row];
  136 + cell.praiseModel = _praiseArrayM[indexPath.row];
132 137 return cell;
133 138 }
134 139 }
... ...