Commit 4b2c9ea26b8162a06b13dcb4d73f417a1cea001e
1 parent
dd108730
电视台数据改为本地数据
Showing
4 changed files
with
37 additions
and
121 deletions
LiveVideoCloud.xcodeproj/project.pbxproj
| ... | ... | @@ -93,7 +93,6 @@ |
| 93 | 93 | 8157A0191EE1452800ADD6B9 /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */; }; |
| 94 | 94 | 8157A01A1EE1452800ADD6B9 /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 95 | 95 | 81A1B9A91E8277410079FF5F /* LVCInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A1B9A81E8277410079FF5F /* LVCInputView.m */; }; |
| 96 | - 81A482F51E88ACC80097A80A /* LVCTelevisionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A482F41E88ACC80097A80A /* LVCTelevisionView.m */; }; | |
| 97 | 96 | 81A482F81E88AFA20097A80A /* LVCFirstHeaderReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A482F71E88AFA20097A80A /* LVCFirstHeaderReusableView.m */; }; |
| 98 | 97 | 81A483021E88B0130097A80A /* LVCChatRoomModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483001E88B0130097A80A /* LVCChatRoomModel.m */; }; |
| 99 | 98 | 81A483051E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */; }; |
| ... | ... | @@ -107,6 +106,8 @@ |
| 107 | 106 | 81A4831D1E88E1EB0097A80A /* LVCMoreSortTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A4831C1E88E1EB0097A80A /* LVCMoreSortTableViewCell.m */; }; |
| 108 | 107 | 81A483201E88F4BF0097A80A /* LVCProgramModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */; }; |
| 109 | 108 | 81CE9E1B1E8CF567000F8F6B /* LVCRequestFailedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81CE9E1A1E8CF567000F8F6B /* LVCRequestFailedView.m */; }; |
| 109 | + 81DFC4241F01132D0029BCB3 /* LVCTelevisionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DFC4231F01132D0029BCB3 /* LVCTelevisionView.m */; }; | |
| 110 | + 81DFC4261F0113B40029BCB3 /* JsonFile.json in Resources */ = {isa = PBXBuildFile; fileRef = 81DFC4251F0113B40029BCB3 /* JsonFile.json */; }; | |
| 110 | 111 | 81F1C8381E8BBDDA0085C2B8 /* MHPagingScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81F1C8371E8BBDDA0085C2B8 /* MHPagingScrollView.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; |
| 111 | 112 | 81F1C8401E8BC5CC0085C2B8 /* NSArray+Safety.m in Sources */ = {isa = PBXBuildFile; fileRef = 81F1C83F1E8BC5CC0085C2B8 /* NSArray+Safety.m */; }; |
| 112 | 113 | 81FB5B3C1E7A6FFC00F98E1D /* SevenSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */; }; |
| ... | ... | @@ -483,8 +484,6 @@ |
| 483 | 484 | 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; |
| 484 | 485 | 81A1B9A71E8277410079FF5F /* LVCInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCInputView.h; sourceTree = "<group>"; }; |
| 485 | 486 | 81A1B9A81E8277410079FF5F /* LVCInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCInputView.m; sourceTree = "<group>"; }; |
| 486 | - 81A482F31E88ACC80097A80A /* LVCTelevisionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LVCTelevisionView.h; path = LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.h; sourceTree = SOURCE_ROOT; }; | |
| 487 | - 81A482F41E88ACC80097A80A /* LVCTelevisionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LVCTelevisionView.m; path = LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.m; sourceTree = SOURCE_ROOT; }; | |
| 488 | 487 | 81A482F61E88AFA20097A80A /* LVCFirstHeaderReusableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCFirstHeaderReusableView.h; sourceTree = "<group>"; }; |
| 489 | 488 | 81A482F71E88AFA20097A80A /* LVCFirstHeaderReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCFirstHeaderReusableView.m; sourceTree = "<group>"; }; |
| 490 | 489 | 81A482FF1E88B0130097A80A /* LVCChatRoomModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCChatRoomModel.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -511,6 +510,9 @@ |
| 511 | 510 | 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCProgramModel.m; sourceTree = "<group>"; }; |
| 512 | 511 | 81CE9E191E8CF567000F8F6B /* LVCRequestFailedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCRequestFailedView.h; sourceTree = "<group>"; }; |
| 513 | 512 | 81CE9E1A1E8CF567000F8F6B /* LVCRequestFailedView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCRequestFailedView.m; sourceTree = "<group>"; }; |
| 513 | + 81DFC4221F01132D0029BCB3 /* LVCTelevisionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTelevisionView.h; sourceTree = "<group>"; }; | |
| 514 | + 81DFC4231F01132D0029BCB3 /* LVCTelevisionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTelevisionView.m; sourceTree = "<group>"; }; | |
| 515 | + 81DFC4251F0113B40029BCB3 /* JsonFile.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = JsonFile.json; sourceTree = "<group>"; }; | |
| 514 | 516 | 81F1C8361E8BBDDA0085C2B8 /* MHPagingScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MHPagingScrollView.h; sourceTree = "<group>"; }; |
| 515 | 517 | 81F1C8371E8BBDDA0085C2B8 /* MHPagingScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MHPagingScrollView.m; sourceTree = "<group>"; }; |
| 516 | 518 | 81F1C83E1E8BC5CC0085C2B8 /* NSArray+Safety.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+Safety.h"; sourceTree = "<group>"; }; |
| ... | ... | @@ -2014,6 +2016,7 @@ |
| 2014 | 2016 | D25BF88A1E7F7F77007FB138 /* Resource */ = { |
| 2015 | 2017 | isa = PBXGroup; |
| 2016 | 2018 | children = ( |
| 2019 | + 81DFC4251F0113B40029BCB3 /* JsonFile.json */, | |
| 2017 | 2020 | D25BF88C1E7F7F77007FB138 /* Images */, |
| 2018 | 2021 | D25BF88B1E7F7F77007FB138 /* Fonts */, |
| 2019 | 2022 | D25BF88D1E7F7F77007FB138 /* Sound */, |
| ... | ... | @@ -2134,8 +2137,8 @@ |
| 2134 | 2137 | 811BB67B1E80F858005C6291 /* ChatView */, |
| 2135 | 2138 | 810B64DE1E779AE900133E15 /* LVCPlayer.h */, |
| 2136 | 2139 | 810B64DF1E779AE900133E15 /* LVCPlayer.m */, |
| 2137 | - 81A482F31E88ACC80097A80A /* LVCTelevisionView.h */, | |
| 2138 | - 81A482F41E88ACC80097A80A /* LVCTelevisionView.m */, | |
| 2140 | + 81DFC4221F01132D0029BCB3 /* LVCTelevisionView.h */, | |
| 2141 | + 81DFC4231F01132D0029BCB3 /* LVCTelevisionView.m */, | |
| 2139 | 2142 | 81A482F61E88AFA20097A80A /* LVCFirstHeaderReusableView.h */, |
| 2140 | 2143 | 81A482F71E88AFA20097A80A /* LVCFirstHeaderReusableView.m */, |
| 2141 | 2144 | 81A483091E88B7EE0097A80A /* LVCOtherHeaderReusableView.h */, |
| ... | ... | @@ -2287,6 +2290,7 @@ |
| 2287 | 2290 | buildActionMask = 2147483647; |
| 2288 | 2291 | files = ( |
| 2289 | 2292 | D2029C971E6EADE10027CD92 /* Info.plist in Resources */, |
| 2293 | + 81DFC4261F0113B40029BCB3 /* JsonFile.json in Resources */, | |
| 2290 | 2294 | D2575C7F1E76A4F300E3A8FC /* NHPlaneViews.xib in Resources */, |
| 2291 | 2295 | D2575C7B1E76A4F300E3A8FC /* NHCarViews.xib in Resources */, |
| 2292 | 2296 | D25BF8901E7F7F8F007FB138 /* UGCLoading.jpeg in Resources */, |
| ... | ... | @@ -2357,6 +2361,7 @@ |
| 2357 | 2361 | 810B65051E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, |
| 2358 | 2362 | D2029CCB1E6EADE10027CD92 /* SVRadialGradientLayer.m in Sources */, |
| 2359 | 2363 | 8130911E1E84C0F0005F0BFF /* LVCMessage.m in Sources */, |
| 2364 | + 81DFC4241F01132D0029BCB3 /* LVCTelevisionView.m in Sources */, | |
| 2360 | 2365 | D23696841E7FC6A900E4BF71 /* chatListCell.m in Sources */, |
| 2361 | 2366 | 4B45CE7B1EB86A590079AFB7 /* MinePersonalDataController.m in Sources */, |
| 2362 | 2367 | D2029CAF1E6EADE10027CD92 /* MJRefreshStateHeader.m in Sources */, |
| ... | ... | @@ -2411,7 +2416,6 @@ |
| 2411 | 2416 | 810B65031E779B1F00133E15 /* MASViewConstraint.m in Sources */, |
| 2412 | 2417 | D2029BCE1E6EADD70027CD92 /* ZXNavigationController.m in Sources */, |
| 2413 | 2418 | D23BBDC71EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.m in Sources */, |
| 2414 | - 81A482F51E88ACC80097A80A /* LVCTelevisionView.m in Sources */, | |
| 2415 | 2419 | D2F0486A1EE54E860011E39C /* LVCLiveActivityInfoService.m in Sources */, |
| 2416 | 2420 | D2029CA21E6EADE10027CD92 /* MJRefreshAutoFooter.m in Sources */, |
| 2417 | 2421 | D2029CC71E6EADE10027CD92 /* SVIndefiniteAnimatedView.m in Sources */, | ... | ... |
LiveVideoCloud/Classes/Sections/homeSections/View/LVCOtherHeaderReusableView.m
| ... | ... | @@ -7,13 +7,11 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "LVCOtherHeaderReusableView.h" |
| 10 | -#import "LVCMoreProgramViewController.h" | |
| 11 | 10 | |
| 12 | 11 | @interface LVCOtherHeaderReusableView () |
| 13 | 12 | |
| 14 | 13 | @property (nonatomic, strong)UIButton *button; |
| 15 | 14 | @property (nonatomic, strong)UIView *intervalView; |
| 16 | -@property (nonatomic, strong)UIImageView *arrow; | |
| 17 | 15 | |
| 18 | 16 | @end |
| 19 | 17 | |
| ... | ... | @@ -30,23 +28,12 @@ |
| 30 | 28 | intervalView.backgroundColor = [UIColor backgroundColorZX]; |
| 31 | 29 | [self addSubview:intervalView]; |
| 32 | 30 | [self addSubview:self.button]; |
| 33 | - [self addSubview:self.arrow]; | |
| 34 | 31 | |
| 35 | 32 | } |
| 36 | 33 | return self; |
| 37 | 34 | } |
| 38 | 35 | |
| 39 | 36 | #pragma mark - |
| 40 | -#pragma mark - Action | |
| 41 | -- (void)buttonAction | |
| 42 | -{ | |
| 43 | - LVCMoreProgramViewController *more = [[LVCMoreProgramViewController alloc]init]; | |
| 44 | - more.cid = _model.cid; | |
| 45 | - more.title = _model.title; | |
| 46 | - [self.viewController.navigationController pushViewController:more animated:YES]; | |
| 47 | -} | |
| 48 | - | |
| 49 | -#pragma mark - | |
| 50 | 37 | #pragma mark - setter |
| 51 | 38 | - (void)setModel:(LVCChannelsModel *)model { |
| 52 | 39 | |
| ... | ... | @@ -63,19 +50,9 @@ |
| 63 | 50 | _button.frame = CGRectMake(0, 6, self.frame.size.width, 47); |
| 64 | 51 | [_button setTitleColor:[UIColor blackColorZX] forState:UIControlStateNormal]; |
| 65 | 52 | _button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; |
| 66 | - [_button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 67 | 53 | _button.titleLabel.font = [UIFont boldSystemFontOfSize:18]; |
| 68 | 54 | } |
| 69 | 55 | return _button; |
| 70 | 56 | } |
| 71 | 57 | |
| 72 | -- (UIImageView *)arrow | |
| 73 | -{ | |
| 74 | - if (!_arrow) { | |
| 75 | - _arrow = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-5-15, 19, 15, 21)]; | |
| 76 | - _arrow.image = [UIImage imageNamed:@"gengduo"]; | |
| 77 | - } | |
| 78 | - return _arrow; | |
| 79 | -} | |
| 80 | - | |
| 81 | 58 | @end | ... | ... |
LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.m
| ... | ... | @@ -13,25 +13,17 @@ |
| 13 | 13 | #import "LVCChannelDetailsModel.h" |
| 14 | 14 | #import "LVCChannelsModel.h" |
| 15 | 15 | #import "LVCLivePlayerController.h" |
| 16 | -#import "LVCRequestFailedView.h" | |
| 17 | 16 | |
| 18 | 17 | static NSString *cellId = @"LVCLiveListCollectionViewCell"; |
| 19 | 18 | static NSString *firstHeaderId = @"LVCFirstHeaderReusableView"; |
| 20 | 19 | static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 21 | 20 | |
| 22 | -@interface LVCTelevisionView ()<UICollectionViewDelegate,UICollectionViewDataSource,LVCRequestFailedViewDelegate> | |
| 23 | -{ | |
| 24 | - long long _timestamp; | |
| 25 | - CGFloat _refreshTime; | |
| 26 | - NSNotification *_liveNotification; | |
| 27 | - BOOL _adImageHidden; //开机广告或引导页是否显示完毕 | |
| 28 | -} | |
| 21 | +@interface LVCTelevisionView ()<UICollectionViewDelegate,UICollectionViewDataSource> | |
| 29 | 22 | |
| 30 | 23 | @property (nonatomic, strong) UICollectionView *collectionView; |
| 31 | 24 | @property (nonatomic, strong) NSArray *bannerModelArray; //banner数据源 |
| 32 | 25 | @property (nonatomic, strong) NSArray *marqueeModelArray; // |
| 33 | 26 | @property (nonatomic, strong) NSArray *channelsModelArray; // |
| 34 | -@property (nonatomic, strong) LVCRequestFailedView *failedView; //请求失败提示view | |
| 35 | 27 | |
| 36 | 28 | @end |
| 37 | 29 | |
| ... | ... | @@ -42,33 +34,15 @@ static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 42 | 34 | self = [super initWithFrame:frame]; |
| 43 | 35 | if (self) { |
| 44 | 36 | |
| 45 | - self.backgroundColor = [UIColor lightGrayColor]; | |
| 46 | - | |
| 47 | - [self loadData]; | |
| 48 | - [self.collectionView addSubview:self.failedView]; | |
| 37 | + self.backgroundColor = [UIColor whiteColor]; | |
| 49 | 38 | [self addSubview:self.collectionView]; |
| 50 | - [self.collectionView.header beginRefreshing]; | |
| 39 | + [self loadData]; | |
| 51 | 40 | |
| 52 | 41 | } |
| 53 | 42 | return self; |
| 54 | 43 | } |
| 55 | 44 | |
| 56 | 45 | #pragma mark - |
| 57 | -#pragma mark - action | |
| 58 | -- (void)refresh | |
| 59 | -{ | |
| 60 | - [self loadData]; | |
| 61 | -} | |
| 62 | - | |
| 63 | -#pragma mark - | |
| 64 | -#pragma mark - LVCRequestFailedViewDelegate | |
| 65 | -- (void)reloadDataWithView:(LVCRequestFailedView *)view | |
| 66 | -{ | |
| 67 | - [self.collectionView.header beginRefreshing]; | |
| 68 | - [self loadData]; | |
| 69 | -} | |
| 70 | - | |
| 71 | -#pragma mark - | |
| 72 | 46 | #pragma mark - UICollectionViewDataSource |
| 73 | 47 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { |
| 74 | 48 | if (self.channelsModelArray.count > 0) { |
| ... | ... | @@ -92,9 +66,6 @@ static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 92 | 66 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { |
| 93 | 67 | |
| 94 | 68 | LVCLiveListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath]; |
| 95 | - | |
| 96 | - cell.backgroundColor = [UIColor lightGrayColor]; | |
| 97 | - | |
| 98 | 69 | LVCChannelsModel *model = _channelsModelArray[indexPath.section - 1]; |
| 99 | 70 | |
| 100 | 71 | LVCChannelDetailsModel *details = model.programs[indexPath.item]; |
| ... | ... | @@ -167,59 +138,35 @@ static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 167 | 138 | #pragma mark - |
| 168 | 139 | #pragma mark - 加载数据 |
| 169 | 140 | - (void)loadData { |
| 141 | + | |
| 142 | + NSString *path = [[NSBundle mainBundle] pathForResource:@"JsonFile" ofType:@"json"]; | |
| 143 | + NSData *data=[NSData dataWithContentsOfFile:path]; | |
| 144 | + NSError *error; | |
| 145 | + id responseObject=[NSJSONSerialization JSONObjectWithData:data | |
| 146 | + options:NSJSONReadingAllowFragments | |
| 147 | + error:&error]; | |
| 148 | +// NSLog(@"%@",responseObject); | |
| 170 | 149 | |
| 171 | - _failedView.hidden = YES; | |
| 172 | - | |
| 173 | - NSDictionary *parameter = @{@"cid": @"zb/", | |
| 174 | - @"plat":@"i", | |
| 175 | - @"appid":@"spzg", | |
| 176 | - @"version":@"1"}; | |
| 177 | - | |
| 178 | - [[AFHTTPSessionManager manager] GET:@"http://app.jczb.cnlive.com/api/appindex?appid=spzg&cid=zb%2F&plat=i&version=1" parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 179 | - _timestamp = [[self timestamp] longLongValue]; | |
| 150 | + if (responseObject[@"channels"] && [responseObject[@"channels"] isKindOfClass:[NSArray class]]) { | |
| 180 | 151 | |
| 181 | - [self.collectionView.header endRefreshing]; | |
| 182 | - | |
| 183 | - if (responseObject[@"channels"] && [responseObject[@"channels"] isKindOfClass:[NSArray class]]) { | |
| 184 | - | |
| 185 | - NSMutableArray *arrayM = [[NSMutableArray alloc]init]; | |
| 186 | - for (NSDictionary *dict in responseObject[@"channels"]) { | |
| 187 | - LVCChannelsModel *model = [LVCChannelsModel mj_objectWithKeyValues:dict]; | |
| 188 | - [arrayM addObject:model]; | |
| 189 | - } | |
| 190 | - self.channelsModelArray = arrayM; | |
| 152 | + NSMutableArray *arrayM = [[NSMutableArray alloc]init]; | |
| 153 | + for (NSDictionary *dict in responseObject[@"channels"]) { | |
| 154 | + LVCChannelsModel *model = [LVCChannelsModel mj_objectWithKeyValues:dict]; | |
| 155 | + [arrayM addObject:model]; | |
| 191 | 156 | } |
| 192 | - if (responseObject[@"banner"] && [responseObject[@"banner"] isKindOfClass:[NSArray class]]) { | |
| 193 | - | |
| 194 | - NSMutableArray *arrayM = [NSMutableArray array]; | |
| 195 | - for (NSDictionary *dict in responseObject[@"banner"]) { | |
| 196 | - LVCChannelDetailsModel *rollModel = [LVCChannelDetailsModel mj_objectWithKeyValues:dict]; | |
| 197 | - [arrayM addObject:rollModel]; | |
| 198 | - } | |
| 199 | - self.bannerModelArray = arrayM; | |
| 200 | - } | |
| 201 | - self.collectionView.backgroundColor = [UIColor whiteColor]; | |
| 202 | - [self.collectionView reloadData]; | |
| 203 | - | |
| 204 | - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 157 | + self.channelsModelArray = arrayM; | |
| 158 | + } | |
| 159 | + if (responseObject[@"banner"] && [responseObject[@"banner"] isKindOfClass:[NSArray class]]) { | |
| 205 | 160 | |
| 206 | - [self.collectionView.header endRefreshing]; | |
| 207 | - if (self.channelsModelArray.count == 0 && self.bannerModelArray.count == 0) { | |
| 208 | - _failedView.hidden = NO; | |
| 161 | + NSMutableArray *arrayM = [NSMutableArray array]; | |
| 162 | + for (NSDictionary *dict in responseObject[@"banner"]) { | |
| 163 | + LVCChannelDetailsModel *rollModel = [LVCChannelDetailsModel mj_objectWithKeyValues:dict]; | |
| 164 | + [arrayM addObject:rollModel]; | |
| 209 | 165 | } |
| 210 | - | |
| 211 | - }]; | |
| 212 | - | |
| 213 | -} | |
| 214 | - | |
| 215 | -- (NSString *)timestamp { | |
| 216 | - | |
| 217 | - NSString *stamp = @""; | |
| 218 | - | |
| 219 | - stamp = [NSString stringWithFormat:@"%.3f", [[NSDate date] timeIntervalSince1970]]; | |
| 220 | - stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""]; | |
| 166 | + self.bannerModelArray = arrayM; | |
| 167 | + } | |
| 168 | + [self.collectionView reloadData]; | |
| 221 | 169 | |
| 222 | - return stamp; | |
| 223 | 170 | } |
| 224 | 171 | |
| 225 | 172 | #pragma mark - |
| ... | ... | @@ -244,23 +191,10 @@ static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 244 | 191 | |
| 245 | 192 | _collectionView.dataSource = self; |
| 246 | 193 | _collectionView.delegate = self; |
| 247 | - | |
| 248 | - _collectionView.header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refresh)]; | |
| 249 | 194 | } |
| 250 | 195 | return _collectionView; |
| 251 | 196 | } |
| 252 | 197 | |
| 253 | -- (LVCRequestFailedView *)failedView | |
| 254 | -{ | |
| 255 | - if (!_failedView) { | |
| 256 | - _failedView = [[LVCRequestFailedView alloc] initWithFrame:CGRectMake(0, 0, 150, 100) words:@"您的网络不太顺畅哦~"]; | |
| 257 | - _failedView.center = self.collectionView.center; | |
| 258 | - _failedView.delegate = self; | |
| 259 | - _failedView.hidden = YES; | |
| 260 | - } | |
| 261 | - return _failedView; | |
| 262 | -} | |
| 263 | - | |
| 264 | 198 | /* |
| 265 | 199 | // Only override drawRect: if you perform custom drawing. |
| 266 | 200 | // An empty implementation adversely affects performance during animation. | ... | ... |
LiveVideoCloud/Resource/JsonFile.json
0 → 100644
| 1 | +{"banner":[{"mediaId":"88da3d45ad2f2745c586ea51b32b2121a6","subTitle":"大型现代原创木偶剧《飞吧 丹顶鹤》","title":"原创木偶剧飞吧丹顶鹤","picType":"small","img":"http://y1.cnliveimg.com:8080/image/itv/2016/0601/da3d45ad2f2745c586ea51b32b2121a6_100.jpg","docID":"618405","vipFlag":"0","type":"program","url":"http://www.cnlive.com/liveshow/v_gyytqnbqgu.html"},{"mediaId":"liveshow","subTitle":"最打动人心的主题音乐故事访谈","title":"liveshow直播:我的音乐故事","picType":"small","img":"http://yweb3.cnliveimg.com/img/cnlive/160129105318359_583.jpg","docID":"408481","vipFlag":"0","type":"live","url":"http://live.cnlive.com/liveshow.html"},{"mediaId":"vhd","subTitle":"热点大事件,萌宠陪你开心唠!体验不一样的资讯直播,戳这里!","title":"侃侃总动员","picType":"small","img":"http://yweb1.cnliveimg.com/img/cnlive/160323165036485_383.jpg","docID":"411530","vipFlag":"0","type":"live","url":"http://live.cnlive.com/vhd.html"}],"marquee":[{"mediaId":"dongnanweishi","subTitle":"海峡西岸经济区主流媒体","title":"东南卫视","picType":"small","img":"http://y1.cnliveimg.com:8080/img/cnlive/public/141110143521312_163.jpg","docID":"410681","vipFlag":"0","type":"live","url":"http://live.cnlive.com/dongnanweishi.html"}],"channels":[{"cid":"live_/tctv/","title":"自主特色直播","channelType":"H","programs":[{"mediaId":"61ca3833365f4fe2975c7db183b61892","subTitle":"互动直播测试","title":"侃侃总动员","desc":"主持人与虚拟萌物合作直播","picType":"small","currentPlay":"神秘原始部落制木乃伊","img":"http://yweb1.cnliveimg.com/img/cnlive/160118114000423_284.jpg","docID":"573134","vipFlag":"0","type":"album","itemId":"581018","url":"http://www.cnlive.com/news/v_gu3tgmjtgq.html","nextPlay":"地球上最热的地狱盐矿"},{"mediaId":"xbxjy","subTitle":"小笨熊教育","title":"小笨熊教育","desc":"为3至12岁儿童精心打造优质的教育频道,包含经典古诗学习,国学教育智力培养,行为教育,文化教育,行为规范、安全教育等内容,其中也不少的精彩的童话故事和家长和儿童之间可以互动的亲子互动内容。节目高清流畅,内容全部正向有趣,是目前最好的儿童教育频道。","picType":"small","currentPlay":"不小心割破手指该怎么办","img":"http://yweb2.cnliveimg.com/cnlive/public/160530111952623_945.jpg","docID":"617301","vipFlag":"0","type":"live","itemId":"595600","url":"http://live.cnlive.com/xbxjy.html","nextPlay":"上下楼梯要注意什么"},{"mediaId":"liveshow","subTitle":"最打动人心的主题音乐故事访谈","title":"LiveShow","desc":"最震撼的演唱会直播、最打动人心的主题音乐故事访谈、最搞笑的剧场话剧直播!","picType":"small","currentPlay":"20151020我的音乐故事音乐小神兽汪苏泷","img":"http://yweb0.cnliveimg.com/cnlive/public/150417133551285_693.png","docID":"408481","vipFlag":"0","type":"live","itemId":"581019","url":"http://live.cnlive.com/liveshow.html","nextPlay":"20151113摇滚男孩王晓天做客音乐故事!"},{"mediaId":"news","subTitle":"","title":"快新闻","desc":"时政、社会、财经、文体、奇趣等快新闻,最热门、最新鲜、最快捷,互动直达!","picType":"small","currentPlay":"南非已开始退出国际刑事法院","img":"http://yweb1.cnliveimg.com/img/cnlive/160121113653827_867.png","docID":"285697","vipFlag":"0","type":"live","itemId":"581021","url":"http://live.cnlive.com/news.html","nextPlay":"少年宿舍坠楼而亡疑在校受辱"},{"mediaId":"eyule","subTitle":"","title":"e娱乐","desc":"热辣娱文、新鲜速递、聊电影、说大片,特色直播精彩呈现!","picType":"small","currentPlay":"网络博主斥港媒为谢霆锋洗白","img":"http://yweb2.cnliveimg.com/img/cnlive/160121113659992_585.png","docID":"408480","vipFlag":"0","type":"live","itemId":"581022","url":"http://live.cnlive.com/eyule.html","nextPlay":"袁姗姗陈晓面对潜规则超淡定"},{"mediaId":"chaotiyu","subTitle":"","title":"潮体育","desc":"赛事直播、最新体坛资讯,全方位扫描热点体坛人物、绝色花边!","picType":"small","currentPlay":"情暖你我2017爱在马城","img":"http://yweb3.cnliveimg.com/img/cnlive/160121113706887_696.png","docID":"285698","vipFlag":"0","type":"live","itemId":"581023","url":"http://live.cnlive.com/chaotiyu.html","nextPlay":"策马扬鞭!欢聚“乐在马城”"},{"mediaId":"xuanhanyu","subTitle":"韩剧韩片韩综 有你想看的!","title":"炫韩娱","desc":"韩国动态、思密达帮帮团、搞笑综艺等,第一知晓韩国娱乐动态,尽在炫韩娱直播频道!","picType":"small","currentPlay":"尹施允被鬼吓金赛纶霸气镇场","img":"http://yweb0.cnliveimg.com/cnlive/public/150417133341123_878.png","docID":"408487","vipFlag":"0","type":"live","itemId":"581024","url":"http://live.cnlive.com/xuanhanyu.html","nextPlay":"Eric徐贤真约会玩绑架被抓!"},{"mediaId":"inyuetai","subTitle":"音乐爱好者的完美聚集地","title":"in乐台","desc":"新歌抢线、MV鉴赏、明星访谈,明星亲临现场诉说音乐故事。大咖们邀你一起感受听觉上的饕餮盛宴。","picType":"small","currentPlay":"新单《WeDontTalkAnymore》","img":"http://yweb1.cnliveimg.com/cnlive/public/150417144750615_185.png","docID":"285696","vipFlag":"0","type":"live","itemId":"581025","url":"http://live.cnlive.com/inyuetai.html","nextPlay":"酷玩《AHeadFullOfDreams》"}]},{"cid":"live_/CIBN/","title":"CIBN","channelType":"H","programs":[{"mediaId":"cibn_lvyou","subTitle":"荟聚全球当红明星,最新的音乐资讯","title":"CIBN嗨播","desc":"荟聚全球当红明星,最新的音乐资讯,劲爆的演唱会现场,包罗万象的热门音乐排行榜,足不出户悦享饕餮音乐盛宴。","picType":"small","currentPlay":"夏季音乐季《梦幻与激情》","img":"http://yweb0.cnliveimg.com/cnlive/public/170428170445759_292.jpg","docID":"427049","vipFlag":"0","type":"live","itemId":"689292","url":"http://live.cnlive.com/cibn_lvyou.html","nextPlay":"SNH48 GROUP 2017年度大型青春励志纪录片《我心翱翔》"},{"mediaId":"cibn_dianying","subTitle":"CIBN电影频道","title":"CIBN电影频道","desc":"","picType":"small","currentPlay":"电话谋杀案","img":"http://yweb2.cnliveimg.com/img/cnlive/160120143835091_965.jpg","docID":"427031","vipFlag":"0","type":"live","itemId":"421082","url":"http://live.cnlive.com/cibn_dianying.html","nextPlay":"内心引力 预告片"},{"mediaId":"cibn_weidianying","subTitle":"CIBN微电影","title":"CIBN微电影","desc":"","picType":"small","currentPlay":"二次元 10 探店 拉面 上","img":"http://yweb3.cnliveimg.com/img/cnlive/160120143842769_360.jpg","docID":"427050","vipFlag":"0","type":"live","itemId":"421083","url":"http://live.cnlive.com/cibn_weidianying.html","nextPlay":"脂肪君-02-人鱼线"},{"mediaId":"cibn_rebo","subTitle":"CIBN热播剧场","title":"CIBN热播剧场","desc":"","picType":"small","currentPlay":"一粒红尘10","img":"http://yweb1.cnliveimg.com/img/cnlive/160120143857458_721.jpg","docID":"427032","vipFlag":"0","type":"live","itemId":"421085","url":"http://live.cnlive.com/cibn_rebo.html","nextPlay":"碧生源常箐茶"},{"mediaId":"cibn_jilu","subTitle":"CIBN纪录","title":"CIBN纪录","desc":"","picType":"small","currentPlay":"赞比西河 生命之源","img":"http://yweb2.cnliveimg.com/img/cnlive/160120143906855_603.jpg","docID":"427048","vipFlag":"0","type":"live","itemId":"421086","url":"http://live.cnlive.com/cibn_jilu.html","nextPlay":"CAN TV 广告片"},{"mediaId":"cibn_zongyi","subTitle":"CIBN综艺","title":"CIBN综艺","desc":"","picType":"small","currentPlay":"金古珍藏 频道宣传片","img":"http://yweb3.cnliveimg.com/img/cnlive/160120143913782_912.jpg","docID":"427046","vipFlag":"0","type":"live","itemId":"421087","url":"http://live.cnlive.com/cibn_zongyi.html","nextPlay":"匠作之传播善与美的白瓷菩萨造像"}]}],"errorMessage":"数据加载成功","errorCode":"0"} | |
| 0 | 2 | \ No newline at end of file | ... | ... |