Commit d328b0a3843057c2a9967bb835665cdb3a186f3b
1 parent
fac5c611
动态banar图调整,移除无用类
Showing
6 changed files
with
9 additions
and
348 deletions
CNLiveScioLive.xcodeproj/project.pbxproj
| @@ -90,9 +90,6 @@ | @@ -90,9 +90,6 @@ | ||
| 90 | 084ACE3B2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */; }; | 90 | 084ACE3B2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */; }; |
| 91 | 084ACE3C2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */; }; | 91 | 084ACE3C2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */; }; |
| 92 | 084ACE3D2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */; }; | 92 | 084ACE3D2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */; }; |
| 93 | - 084ACE402154D7F70089E035 /* CNHomeBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3F2154D7F70089E035 /* CNHomeBaseViewController.m */; }; | ||
| 94 | - 084ACE412154D7F70089E035 /* CNHomeBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3F2154D7F70089E035 /* CNHomeBaseViewController.m */; }; | ||
| 95 | - 084ACE422154D7F70089E035 /* CNHomeBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 084ACE3F2154D7F70089E035 /* CNHomeBaseViewController.m */; }; | ||
| 96 | 08515D07215B81E900411756 /* TopNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08515D06215B81E900411756 /* TopNoticeViewController.m */; }; | 93 | 08515D07215B81E900411756 /* TopNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08515D06215B81E900411756 /* TopNoticeViewController.m */; }; |
| 97 | 08515D08215B81E900411756 /* TopNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08515D06215B81E900411756 /* TopNoticeViewController.m */; }; | 94 | 08515D08215B81E900411756 /* TopNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08515D06215B81E900411756 /* TopNoticeViewController.m */; }; |
| 98 | 08515D09215B81E900411756 /* TopNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08515D06215B81E900411756 /* TopNoticeViewController.m */; }; | 95 | 08515D09215B81E900411756 /* TopNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08515D06215B81E900411756 /* TopNoticeViewController.m */; }; |
| @@ -792,8 +789,6 @@ | @@ -792,8 +789,6 @@ | ||
| 792 | 084ACE352154C6D60089E035 /* CNLiveNewsLeftPicTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveNewsLeftPicTableViewCell.m; sourceTree = "<group>"; }; | 789 | 084ACE352154C6D60089E035 /* CNLiveNewsLeftPicTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveNewsLeftPicTableViewCell.m; sourceTree = "<group>"; }; |
| 793 | 084ACE392154C8310089E035 /* CNLiveNewsUpPicTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveNewsUpPicTableViewCell.h; sourceTree = "<group>"; }; | 790 | 084ACE392154C8310089E035 /* CNLiveNewsUpPicTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveNewsUpPicTableViewCell.h; sourceTree = "<group>"; }; |
| 794 | 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveNewsUpPicTableViewCell.m; sourceTree = "<group>"; }; | 791 | 084ACE3A2154C8310089E035 /* CNLiveNewsUpPicTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveNewsUpPicTableViewCell.m; sourceTree = "<group>"; }; |
| 795 | - 084ACE3E2154D7F70089E035 /* CNHomeBaseViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNHomeBaseViewController.h; sourceTree = "<group>"; }; | ||
| 796 | - 084ACE3F2154D7F70089E035 /* CNHomeBaseViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNHomeBaseViewController.m; sourceTree = "<group>"; }; | ||
| 797 | 08515D05215B81E900411756 /* TopNoticeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopNoticeViewController.h; sourceTree = "<group>"; }; | 792 | 08515D05215B81E900411756 /* TopNoticeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopNoticeViewController.h; sourceTree = "<group>"; }; |
| 798 | 08515D06215B81E900411756 /* TopNoticeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopNoticeViewController.m; sourceTree = "<group>"; }; | 793 | 08515D06215B81E900411756 /* TopNoticeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopNoticeViewController.m; sourceTree = "<group>"; }; |
| 799 | 08585CE3215B302C00FC2CA2 /* CNLiveSearchViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveSearchViewController.h; sourceTree = "<group>"; }; | 794 | 08585CE3215B302C00FC2CA2 /* CNLiveSearchViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveSearchViewController.h; sourceTree = "<group>"; }; |
| @@ -1813,8 +1808,6 @@ | @@ -1813,8 +1808,6 @@ | ||
| 1813 | children = ( | 1808 | children = ( |
| 1814 | 08C09000214FB0E600E23D16 /* CNHomeViewController.h */, | 1809 | 08C09000214FB0E600E23D16 /* CNHomeViewController.h */, |
| 1815 | 08C09001214FB0E600E23D16 /* CNHomeViewController.m */, | 1810 | 08C09001214FB0E600E23D16 /* CNHomeViewController.m */, |
| 1816 | - 084ACE3E2154D7F70089E035 /* CNHomeBaseViewController.h */, | ||
| 1817 | - 084ACE3F2154D7F70089E035 /* CNHomeBaseViewController.m */, | ||
| 1818 | 08384845215C98A000186618 /* CNHomeENViewController.h */, | 1811 | 08384845215C98A000186618 /* CNHomeENViewController.h */, |
| 1819 | 08384846215C98A000186618 /* CNHomeENViewController.m */, | 1812 | 08384846215C98A000186618 /* CNHomeENViewController.m */, |
| 1820 | 084ACE202154B1270089E035 /* CNHomeModel.h */, | 1813 | 084ACE202154B1270089E035 /* CNHomeModel.h */, |
| @@ -2866,7 +2859,6 @@ | @@ -2866,7 +2859,6 @@ | ||
| 2866 | 08585D86215B4C7200FC2CA2 /* PGDatePicker+Common.m in Sources */, | 2859 | 08585D86215B4C7200FC2CA2 /* PGDatePicker+Common.m in Sources */, |
| 2867 | 08C090732150C79C00E23D16 /* UIView+ViewController.m in Sources */, | 2860 | 08C090732150C79C00E23D16 /* UIView+ViewController.m in Sources */, |
| 2868 | 085D86D1215A3BFD0037D480 /* CNLiveUserUpdateViewController.m in Sources */, | 2861 | 085D86D1215A3BFD0037D480 /* CNLiveUserUpdateViewController.m in Sources */, |
| 2869 | - 084ACE402154D7F70089E035 /* CNHomeBaseViewController.m in Sources */, | ||
| 2870 | 08C08FE3214FA01B00E23D16 /* CNLiveViewController.m in Sources */, | 2862 | 08C08FE3214FA01B00E23D16 /* CNLiveViewController.m in Sources */, |
| 2871 | 0838483E215C838B00186618 /* CNLiveENTabBarController.m in Sources */, | 2863 | 0838483E215C838B00186618 /* CNLiveENTabBarController.m in Sources */, |
| 2872 | 085D86C7215A20A50037D480 /* CNLiveUserSettingViewController.m in Sources */, | 2864 | 085D86C7215A20A50037D480 /* CNLiveUserSettingViewController.m in Sources */, |
| @@ -3143,7 +3135,6 @@ | @@ -3143,7 +3135,6 @@ | ||
| 3143 | 08B5C5AD21535D4400F5476E /* NSString+Validation.m in Sources */, | 3135 | 08B5C5AD21535D4400F5476E /* NSString+Validation.m in Sources */, |
| 3144 | 08384853215CA74700186618 /* SCIOSpecialViewController.m in Sources */, | 3136 | 08384853215CA74700186618 /* SCIOSpecialViewController.m in Sources */, |
| 3145 | 08384869215CAB1C00186618 /* YWWebScrollView.m in Sources */, | 3137 | 08384869215CAB1C00186618 /* YWWebScrollView.m in Sources */, |
| 3146 | - 084ACE412154D7F70089E035 /* CNHomeBaseViewController.m in Sources */, | ||
| 3147 | 084ACE19215481870089E035 /* NoDataView.m in Sources */, | 3138 | 084ACE19215481870089E035 /* NoDataView.m in Sources */, |
| 3148 | 0870DACF215F1CE6008DC811 /* VideoPlayBackViewController.m in Sources */, | 3139 | 0870DACF215F1CE6008DC811 /* VideoPlayBackViewController.m in Sources */, |
| 3149 | 08B5C5A221534DC700F5476E /* CNLiveRegisterEmailViewController.m in Sources */, | 3140 | 08B5C5A221534DC700F5476E /* CNLiveRegisterEmailViewController.m in Sources */, |
| @@ -3298,7 +3289,6 @@ | @@ -3298,7 +3289,6 @@ | ||
| 3298 | 08B5C5AE21535D4400F5476E /* NSString+Validation.m in Sources */, | 3289 | 08B5C5AE21535D4400F5476E /* NSString+Validation.m in Sources */, |
| 3299 | 08384854215CA74700186618 /* SCIOSpecialViewController.m in Sources */, | 3290 | 08384854215CA74700186618 /* SCIOSpecialViewController.m in Sources */, |
| 3300 | 0838486A215CAB1C00186618 /* YWWebScrollView.m in Sources */, | 3291 | 0838486A215CAB1C00186618 /* YWWebScrollView.m in Sources */, |
| 3301 | - 084ACE422154D7F70089E035 /* CNHomeBaseViewController.m in Sources */, | ||
| 3302 | 084ACE1A215481870089E035 /* NoDataView.m in Sources */, | 3292 | 084ACE1A215481870089E035 /* NoDataView.m in Sources */, |
| 3303 | 0870DAD0215F1CE6008DC811 /* VideoPlayBackViewController.m in Sources */, | 3293 | 0870DAD0215F1CE6008DC811 /* VideoPlayBackViewController.m in Sources */, |
| 3304 | 08B5C5A321534DC700F5476E /* CNLiveRegisterEmailViewController.m in Sources */, | 3294 | 08B5C5A321534DC700F5476E /* CNLiveRegisterEmailViewController.m in Sources */, |
CNLiveScioLive/Pages/Home/CNHomeBaseViewController.h deleted
100755 → 0
| 1 | -// | ||
| 2 | -// CNHomeBaseViewController.h | ||
| 3 | -// CNLiveScioLive | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2018/9/21. | ||
| 6 | -// Copyright © 2018年 CNLive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNLiveBaseViewController.h" | ||
| 10 | - | ||
| 11 | -@interface CNHomeBaseViewController : CNLiveBaseViewController | ||
| 12 | -@property (nonatomic, copy) NSString *cid; | ||
| 13 | - | ||
| 14 | -@end |
CNLiveScioLive/Pages/Home/CNHomeBaseViewController.m deleted
100755 → 0
| 1 | -// | ||
| 2 | -// CNHomeBaseViewController.m | ||
| 3 | -// CNLiveScioLive | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2018/9/21. | ||
| 6 | -// Copyright © 2018年 CNLive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNHomeBaseViewController.h" | ||
| 10 | -#import "CNHomeModel.h" | ||
| 11 | - | ||
| 12 | -#import "CNLiveNewsNoPicTableViewCell.h" | ||
| 13 | -#import "CNLiveNewsThreePicTableViewCell.h" | ||
| 14 | -#import "CNLiveNewsLeftPicTableViewCell.h" | ||
| 15 | -#import "CNLiveNewsUpPicTableViewCell.h" | ||
| 16 | - | ||
| 17 | - | ||
| 18 | -@interface CNHomeBaseViewController ()<UITableViewDelegate,UITableViewDataSource> | ||
| 19 | -@property (nonatomic, strong) UITableView *tableView; | ||
| 20 | -@property (nonatomic, strong) NSMutableArray *data; | ||
| 21 | -@property (nonatomic, assign) NSInteger pageNo; | ||
| 22 | -@property (nonatomic, assign) BOOL isRefreshing; | ||
| 23 | - | ||
| 24 | -@end | ||
| 25 | - | ||
| 26 | -@implementation CNHomeBaseViewController | ||
| 27 | -static NSString *newsNoPicTableViewCell = @"CNLiveNewsNoPicTableViewCell"; | ||
| 28 | -static NSString *newsThreePicTableViewCell = @"CNLiveNewsThreePicTableViewCell"; | ||
| 29 | -static NSString *newsLeftPicTableViewCell = @"CNLiveNewsLeftPicTableViewCell"; | ||
| 30 | -static NSString *newsUpPicTableViewCell = @"CNLiveNewsUpPicTableViewCell"; | ||
| 31 | - | ||
| 32 | -#pragma mark - Data | ||
| 33 | -- (void)loadData{ | ||
| 34 | - NSString *strUrl = REQUESTURL(@"gxb/api/cataloglatest"); | ||
| 35 | - //NSLog(@"%@",strUrl); | ||
| 36 | - NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"categoryId\":\"%@\",\"page\":\"%ld\",\"pageSize\":\"10\"}",self.cid,(long)self.pageNo]; | ||
| 37 | - //NSLog(@"%@",categoryId); | ||
| 38 | - NSDictionary *parameters = @{@"params":categoryId}; | ||
| 39 | - | ||
| 40 | - if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { | ||
| 41 | - [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")]; | ||
| 42 | - [self.tableView.mj_header endRefreshing]; | ||
| 43 | - [self.tableView.mj_footer endRefreshing]; | ||
| 44 | - self->_isRefreshing = NO; | ||
| 45 | - return; | ||
| 46 | - } | ||
| 47 | - [AlertViewTool showHUDView]; | ||
| 48 | - [XWHTTPTool POST:strUrl params:parameters success:^(id json) { | ||
| 49 | - [AlertViewTool hideHUDView]; | ||
| 50 | - | ||
| 51 | - // 请求成功,解析数据 | ||
| 52 | - NSDictionary *dic = [NSDictionary dictionaryWithDictionary:json]; | ||
| 53 | - | ||
| 54 | - if ([dic[@"errorCode"] isEqualToString:@"0"]) { | ||
| 55 | - | ||
| 56 | - if ([dic[@"programs"] isKindOfClass:[NSArray class]]) { | ||
| 57 | - NSArray *lists = dic[@"programs"]; | ||
| 58 | - if(self->_pageNo == 1&&lists.count > 0){ | ||
| 59 | - [self.data removeAllObjects]; | ||
| 60 | - } | ||
| 61 | - self->_pageNo++; | ||
| 62 | - for (NSDictionary *dics in lists) { | ||
| 63 | - [CNHomeModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{ | ||
| 64 | - return @{ @"ID" : @"id" ,@"Description" : @"description" }; | ||
| 65 | - }]; | ||
| 66 | - NSLog(@"%@",dics); | ||
| 67 | - [self.data addObject:[CNHomeModel mj_objectWithKeyValues:dics]]; | ||
| 68 | - | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - } else { | ||
| 73 | - [AlertViewTool showHUDViewText:dic[@"errorMessage"]]; | ||
| 74 | - | ||
| 75 | - } | ||
| 76 | - [self.tableView.mj_header endRefreshing]; | ||
| 77 | - | ||
| 78 | - if ([dic[@"nextCursor"] isEqualToString:@"0"]) { | ||
| 79 | - [self.tableView.mj_footer endRefreshingWithNoMoreData]; | ||
| 80 | - | ||
| 81 | - } else { | ||
| 82 | - [self.tableView.mj_footer endRefreshing]; | ||
| 83 | - | ||
| 84 | - } | ||
| 85 | - [self.tableView reloadData]; | ||
| 86 | - self->_isRefreshing = NO; | ||
| 87 | - | ||
| 88 | - | ||
| 89 | - } failure:^(NSError *error) { | ||
| 90 | - [AlertViewTool hideHUDView]; | ||
| 91 | - [AlertViewTool showHUDViewText:CustomStr(@"ServerBusy")]; | ||
| 92 | - self->_isRefreshing = NO; | ||
| 93 | - | ||
| 94 | - }]; | ||
| 95 | -} | ||
| 96 | - | ||
| 97 | -- (void)loadUpData{ | ||
| 98 | - _pageNo = 1; | ||
| 99 | - if(!_isRefreshing){ | ||
| 100 | - _isRefreshing = YES; | ||
| 101 | - [self loadData]; | ||
| 102 | - } | ||
| 103 | -} | ||
| 104 | -- (void)loadMoreData{ | ||
| 105 | - if(!_isRefreshing){ | ||
| 106 | - _isRefreshing = YES; | ||
| 107 | - [self loadData]; | ||
| 108 | - } | ||
| 109 | -} | ||
| 110 | - | ||
| 111 | -- (void)viewDidLoad { | ||
| 112 | - [super viewDidLoad]; | ||
| 113 | - | ||
| 114 | - _pageNo = 1; | ||
| 115 | - _isRefreshing = NO; | ||
| 116 | - | ||
| 117 | - [self loadData]; | ||
| 118 | - [self.view addSubview:self.tableView]; | ||
| 119 | - | ||
| 120 | - // Do any additional setup after loading the view. | ||
| 121 | -} | ||
| 122 | - | ||
| 123 | -- (void)didReceiveMemoryWarning { | ||
| 124 | - [super didReceiveMemoryWarning]; | ||
| 125 | - // Dispose of any resources that can be recreated. | ||
| 126 | -} | ||
| 127 | -#pragma mark - UITableViewDelegate | ||
| 128 | -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
| 129 | - CNHomeModel *model = self.data[indexPath.row]; | ||
| 130 | - if([model.showType isEqualToString:@"0"]){ | ||
| 131 | - return 200*MainHScale+85;//一张图 上边 | ||
| 132 | - | ||
| 133 | - } | ||
| 134 | - else if([model.showType isEqualToString:@"1"]){ | ||
| 135 | - if(model.img && ![model.img isEqualToString:@""]){ | ||
| 136 | - return 80*MainScale+20;//一张图 左边 | ||
| 137 | - } | ||
| 138 | -// return model.titleHeight+40;//无图 | ||
| 139 | - return 80*MainScale+20;//一张图 左边 | ||
| 140 | - | ||
| 141 | - } | ||
| 142 | - else if([model.showType isEqualToString:@"2"]){ | ||
| 143 | - return (MainScreenWidth-20-20)/3.0+85;//三张图 | ||
| 144 | - | ||
| 145 | - } | ||
| 146 | - else if([model.showType isEqualToString:@"3"]){ | ||
| 147 | - if(model.img && ![model.img isEqualToString:@""]){ | ||
| 148 | - return 80*MainScale+20;//一张图 左边 | ||
| 149 | - } | ||
| 150 | -// return model.titleHeight+40;//无图 | ||
| 151 | - return 80*MainScale+20;//一张图 左边 | ||
| 152 | - | ||
| 153 | - }else{ | ||
| 154 | -// return model.titleHeight+40;//无图 | ||
| 155 | - return 80*MainScale+20;//一张图 左边 | ||
| 156 | - | ||
| 157 | - } | ||
| 158 | -} | ||
| 159 | - | ||
| 160 | -#pragma mark - UITableViewDataSource | ||
| 161 | -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | ||
| 162 | - return self.data.count; | ||
| 163 | - | ||
| 164 | -} | ||
| 165 | - | ||
| 166 | -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
| 167 | - CNHomeModel *model = self.data[indexPath.row]; | ||
| 168 | - if([model.showType isEqualToString:@"0"]){ | ||
| 169 | - //一张图 上边 | ||
| 170 | - CNLiveNewsUpPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:newsUpPicTableViewCell]; | ||
| 171 | - if (!cell) { | ||
| 172 | - cell = [[CNLiveNewsUpPicTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:newsUpPicTableViewCell]; | ||
| 173 | - } | ||
| 174 | - cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 175 | - cell.model = self.data[indexPath.row]; | ||
| 176 | - return cell; | ||
| 177 | - | ||
| 178 | - } | ||
| 179 | - else if([model.showType isEqualToString:@"2"]){ | ||
| 180 | - //三张图 | ||
| 181 | - CNLiveNewsThreePicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:newsThreePicTableViewCell]; | ||
| 182 | - if (!cell) { | ||
| 183 | - cell = [[CNLiveNewsThreePicTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:newsThreePicTableViewCell]; | ||
| 184 | - } | ||
| 185 | - cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 186 | - cell.model = self.data[indexPath.row]; | ||
| 187 | - return cell; | ||
| 188 | - | ||
| 189 | - } | ||
| 190 | - else { | ||
| 191 | - if(model.img&&![model.img isEqualToString:@""]){ | ||
| 192 | - //一张图 左边 | ||
| 193 | - CNLiveNewsLeftPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:newsLeftPicTableViewCell]; | ||
| 194 | - if (!cell) { | ||
| 195 | - cell = [[CNLiveNewsLeftPicTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:newsLeftPicTableViewCell]; | ||
| 196 | - } | ||
| 197 | - cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 198 | - cell.model = self.data[indexPath.row]; | ||
| 199 | - return cell; | ||
| 200 | - } | ||
| 201 | - //无图 | ||
| 202 | - CNLiveNewsNoPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:newsNoPicTableViewCell]; | ||
| 203 | - if (!cell) { | ||
| 204 | - cell = [[CNLiveNewsNoPicTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:newsNoPicTableViewCell]; | ||
| 205 | - } | ||
| 206 | -// CNLiveNewsLeftPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:newsLeftPicTableViewCell]; | ||
| 207 | -// if (!cell) { | ||
| 208 | -// cell = [[CNLiveNewsLeftPicTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:newsLeftPicTableViewCell]; | ||
| 209 | -// } | ||
| 210 | - cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 211 | - cell.model = self.data[indexPath.row]; | ||
| 212 | - return cell; | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | -} | ||
| 216 | -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
| 217 | - CNHomeModel *model = self.data[indexPath.row]; | ||
| 218 | - [self pushViewControllerWithModel:model]; | ||
| 219 | -} | ||
| 220 | -/* | ||
| 221 | - #pragma mark - Navigation | ||
| 222 | - | ||
| 223 | - // In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 224 | - - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 225 | - // Get the new view controller using [segue destinationViewController]. | ||
| 226 | - // Pass the selected object to the new view controller. | ||
| 227 | - } | ||
| 228 | - */ | ||
| 229 | -#pragma mark - Action | ||
| 230 | -- (void)pushViewControllerWithModel:(CNHomeModel *)model { | ||
| 231 | - NSDictionary *_dic = [model toDictionary]; | ||
| 232 | - if ([@"program" isEqualToString:_dic[@"type"]]) { | ||
| 233 | - //视频 | ||
| 234 | - OldVideoDetailViewController *vc = [[OldVideoDetailViewController alloc] initWithDictionary:_dic]; | ||
| 235 | - vc.title = _dic[@"cmsColumnName"]; | ||
| 236 | - vc.hidesBottomBarWhenPushed = YES; | ||
| 237 | - [self.navigationController pushViewController:vc animated:YES]; | ||
| 238 | - | ||
| 239 | - } else if ([@"article" isEqualToString:_dic[@"type"]]) { | ||
| 240 | - //文章 | ||
| 241 | - OldArticleDetailViewController *vc = [[OldArticleDetailViewController alloc] initWithDictionary:_dic]; | ||
| 242 | - vc.title = _dic[@"cmsColumnName"]; | ||
| 243 | - vc.hidesBottomBarWhenPushed = YES; | ||
| 244 | - [self.navigationController pushViewController:vc animated:YES]; | ||
| 245 | - | ||
| 246 | - } else if ([@"subject" isEqualToString:_dic[@"type"]]) { | ||
| 247 | - SCIOSpecialViewController *vc = [[SCIOSpecialViewController alloc] initWithDictionary:_dic]; | ||
| 248 | - vc.title = @"国新专题"; | ||
| 249 | - vc.hidesBottomBarWhenPushed = YES; | ||
| 250 | - [self.navigationController pushViewController:vc animated:YES]; | ||
| 251 | - | ||
| 252 | - } else if ([@"LK" isEqualToString:_dic[@"type"]]) { | ||
| 253 | - OldArticleDetailViewController *vc = [[OldArticleDetailViewController alloc] initWithDictionary:_dic]; | ||
| 254 | - vc.title = _dic[@"cmsColumnName"]; | ||
| 255 | - vc.hidesBottomBarWhenPushed = YES; | ||
| 256 | - [self.navigationController pushViewController:vc animated:YES]; | ||
| 257 | - | ||
| 258 | - } | ||
| 259 | -} | ||
| 260 | -#pragma mark - Lazy Laoding | ||
| 261 | -- (UITableView *)tableView{ | ||
| 262 | - if(!_tableView){ | ||
| 263 | - _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, MainScreenWidth, MainScreenHeight-45-NavBarHeight-TabBarHeight) style:UITableViewStylePlain]; | ||
| 264 | - _tableView.delegate = self; | ||
| 265 | - _tableView.dataSource = self; | ||
| 266 | - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
| 267 | - _tableView.backgroundColor = HEXCOLOR(0xebebeb); | ||
| 268 | - _tableView.estimatedRowHeight = 0; | ||
| 269 | - _tableView.estimatedSectionHeaderHeight = 0; | ||
| 270 | - _tableView.estimatedSectionFooterHeight = 0; | ||
| 271 | - | ||
| 272 | - [_tableView registerClass:[CNLiveNewsLeftPicTableViewCell class] forCellReuseIdentifier:newsLeftPicTableViewCell]; | ||
| 273 | - [_tableView registerClass:[CNLiveNewsNoPicTableViewCell class] forCellReuseIdentifier:newsNoPicTableViewCell]; | ||
| 274 | - [_tableView registerClass:[CNLiveNewsUpPicTableViewCell class] forCellReuseIdentifier:newsUpPicTableViewCell]; | ||
| 275 | - [_tableView registerClass:[CNLiveNewsThreePicTableViewCell class] forCellReuseIdentifier:newsThreePicTableViewCell]; | ||
| 276 | - | ||
| 277 | - // 设置上拉加载 | ||
| 278 | - MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadUpData)]; | ||
| 279 | - NSMutableArray *refreshingImages = [NSMutableArray array]; | ||
| 280 | - for (NSUInteger i = 0; i < 4; i++) { | ||
| 281 | - UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"refresh_animation%lu", (unsigned long)i]]; | ||
| 282 | - [refreshingImages addObject:image]; | ||
| 283 | - } | ||
| 284 | - [header setImages:refreshingImages forState:MJRefreshStateRefreshing]; | ||
| 285 | - header.lastUpdatedTimeLabel.hidden = YES; | ||
| 286 | - header.stateLabel.hidden = YES; | ||
| 287 | - _tableView.mj_header = header; | ||
| 288 | - | ||
| 289 | - // 设置下拉刷新 | ||
| 290 | - MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)]; | ||
| 291 | - [footer setTitle:CustomStr(@"RefreshBackFooterIdleText") forState:MJRefreshStateIdle]; | ||
| 292 | - [footer setTitle:CustomStr(@"RefreshBackFooterPullingText") forState:MJRefreshStatePulling]; | ||
| 293 | - [footer setTitle:CustomStr(@"RefreshBackFooterRefreshingText") forState:MJRefreshStateRefreshing]; | ||
| 294 | - [footer setTitle:CustomStr(@"RefreshBackFooterNoMoreDataText") forState:MJRefreshStateNoMoreData]; | ||
| 295 | - _tableView.mj_footer = footer; | ||
| 296 | - | ||
| 297 | - } | ||
| 298 | - return _tableView; | ||
| 299 | -} | ||
| 300 | - | ||
| 301 | -- (NSMutableArray *)data{ | ||
| 302 | - if(!_data){ | ||
| 303 | - _data = [[NSMutableArray alloc] init]; | ||
| 304 | - } | ||
| 305 | - return _data; | ||
| 306 | -} | ||
| 307 | - | ||
| 308 | - | ||
| 309 | -@end |
CNLiveScioLive/Pages/Home/CNHomeViewController.m
| @@ -14,8 +14,6 @@ | @@ -14,8 +14,6 @@ | ||
| 14 | #import "CNLiveHeraldedNewsViewController.h" | 14 | #import "CNLiveHeraldedNewsViewController.h" |
| 15 | #import "CNLiveReporterAskedViewController.h" | 15 | #import "CNLiveReporterAskedViewController.h" |
| 16 | 16 | ||
| 17 | -#import "CNHomeBaseViewController.h" | ||
| 18 | - | ||
| 19 | @interface CNHomeViewController () | 17 | @interface CNHomeViewController () |
| 20 | @property (nonatomic, strong) NSMutableArray *data; | 18 | @property (nonatomic, strong) NSMutableArray *data; |
| 21 | @property (nonatomic, strong) UIButton *reFreshBtn; | 19 | @property (nonatomic, strong) UIButton *reFreshBtn; |
| @@ -75,24 +73,17 @@ | @@ -75,24 +73,17 @@ | ||
| 75 | model.textColor = @""; | 73 | model.textColor = @""; |
| 76 | } | 74 | } |
| 77 | [colors addObject:model.textColor]; | 75 | [colors addObject:model.textColor]; |
| 78 | - if ([model.cid isEqualToString:@"wz/toutiao/"]) { | ||
| 79 | - //外宣要闻 | ||
| 80 | - CNLiveHeraldedNewsViewController *vc = [[CNLiveHeraldedNewsViewController alloc] init]; | ||
| 81 | - vc.cid = model.cid; | ||
| 82 | - [controllers addObject:vc]; | ||
| 83 | - | ||
| 84 | - }else if ([model.cid isEqualToString:@"spzl/djzw/"]) { | 76 | + if ([model.cid isEqualToString:@"spzl/djzw/"]) { |
| 85 | //答记者问 | 77 | //答记者问 |
| 86 | CNLiveReporterAskedViewController *vc = [[CNLiveReporterAskedViewController alloc] init]; | 78 | CNLiveReporterAskedViewController *vc = [[CNLiveReporterAskedViewController alloc] init]; |
| 87 | vc.cid = model.cid; | 79 | vc.cid = model.cid; |
| 88 | [controllers addObject:vc]; | 80 | [controllers addObject:vc]; |
| 89 | 81 | ||
| 90 | }else{ | 82 | }else{ |
| 91 | - //基本 | ||
| 92 | - CNHomeBaseViewController *vc = [[CNHomeBaseViewController alloc] init]; | 83 | + //其他 |
| 84 | + CNLiveHeraldedNewsViewController *vc = [[CNLiveHeraldedNewsViewController alloc] init]; | ||
| 93 | vc.cid = model.cid; | 85 | vc.cid = model.cid; |
| 94 | [controllers addObject:vc]; | 86 | [controllers addObject:vc]; |
| 95 | - | ||
| 96 | } | 87 | } |
| 97 | 88 | ||
| 98 | } | 89 | } |
CNLiveScioLive/Pages/Home/外宣要闻/Controller/CNLiveHeraldedNewsViewController.m
| @@ -97,9 +97,13 @@ static NSString *newsUpPicTableViewCell = @"CNLiveNewsUpPicTableViewCell"; | @@ -97,9 +97,13 @@ static NSString *newsUpPicTableViewCell = @"CNLiveNewsUpPicTableViewCell"; | ||
| 97 | [imagesURLStrings addObject:model.img]; | 97 | [imagesURLStrings addObject:model.img]; |
| 98 | 98 | ||
| 99 | } | 99 | } |
| 100 | + if (titles.count!=0) { | ||
| 101 | + self.tableView.tableHeaderView = self.cycleScrollView; | ||
| 100 | self.cycleScrollView.titlesGroup = titles; | 102 | self.cycleScrollView.titlesGroup = titles; |
| 101 | self.cycleScrollView.imageURLStringsGroup = imagesURLStrings; | 103 | self.cycleScrollView.imageURLStringsGroup = imagesURLStrings; |
| 102 | - | 104 | + } |
| 105 | + }else{ | ||
| 106 | + self.tableView.tableHeaderView = nil; | ||
| 103 | } | 107 | } |
| 104 | } else { | 108 | } else { |
| 105 | [AlertViewTool showHUDViewText:dic[@"errorMessage"]]; | 109 | [AlertViewTool showHUDViewText:dic[@"errorMessage"]]; |
| @@ -148,7 +152,6 @@ static NSString *newsUpPicTableViewCell = @"CNLiveNewsUpPicTableViewCell"; | @@ -148,7 +152,6 @@ static NSString *newsUpPicTableViewCell = @"CNLiveNewsUpPicTableViewCell"; | ||
| 148 | 152 | ||
| 149 | [self loadData]; | 153 | [self loadData]; |
| 150 | [self.view addSubview:self.tableView]; | 154 | [self.view addSubview:self.tableView]; |
| 151 | - self.tableView.tableHeaderView = self.cycleScrollView; | ||
| 152 | 155 | ||
| 153 | // Do any additional setup after loading the view. | 156 | // Do any additional setup after loading the view. |
| 154 | } | 157 | } |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
| @@ -482,7 +482,7 @@ | @@ -482,7 +482,7 @@ | ||
| 482 | return cell; | 482 | return cell; |
| 483 | } | 483 | } |
| 484 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | 484 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
| 485 | - [tableView deselectRowAtIndexPath:indexPath animated:YES]; | 485 | + [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
| 486 | NSLog(@"%@",_newsArray[indexPath.row]); | 486 | NSLog(@"%@",_newsArray[indexPath.row]); |
| 487 | NSDictionary *_dic = _newsArray[indexPath.row]; | 487 | NSDictionary *_dic = _newsArray[indexPath.row]; |
| 488 | [self pushViewTo:_dic]; | 488 | [self pushViewTo:_dic]; |