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