CNLiveViewController.m 20.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
//
//  CNLiveViewController.m
//  CNLiveScioLive
//
//  Created by CNLive-zxw on 2018/9/17.
//  Copyright © 2018年 CNLive. All rights reserved.
//

#import "CNLiveViewController.h"
#import "CNLiveIndicatorTableViewCell.h"
#import "CNLiveTableViewCell.h"

#import "CNLiveModel.h"
#import "CNLiveHeaderView.h"
#import "TopNoticeViewController.h"
#import "VideoPlayBackViewController.h"
#import "GraphicLiveViewController.h"
#import "CNLiveSearchViewController.h"//搜索

@interface CNLiveViewController ()<UITableViewDelegate,UITableViewDataSource>{
    NSArray *_newsArray;
    NSDictionary *_dictionary;
}
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) CNLiveHeaderView *header;
@property (nonatomic, strong) NSMutableArray *data;

@property (nonatomic, assign) NSInteger pageNo;
@property (nonatomic, assign) BOOL isRefreshing;
@property (nonatomic, strong) CNLiveModel *liveModel;

@property (nonatomic, assign) BOOL isLoaded;

@end

@implementation CNLiveViewController
static NSString *liveTableViewCell = @"CNLiveTableViewCell";
static NSString *tableViewCell = @"UITableViewCell";
static NSString *indicatorTableViewCell = @"CNLiveIndicatorTableViewCell";

#pragma mark - Data
- (void)getData{
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
        NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"LiveHeader"];
        if (data) {
            [self dealDictionaryData:data];
        }
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
        return;
    }
    [XWHTTPTool POST:LiveUrl params:nil success:^(id json) {

        [MBProgressHUD hideHUDForView:self.view animated:YES];
        
        // 请求成功,解析数据
        NSDictionary *dic = [NSDictionary dictionaryWithDictionary:json];
        NSData *data = [dic mj_JSONData];
        [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"LiveHeader"];
        [self dealDictionaryData:data];
//        self->_isLoaded = YES;
        
    } failure:^(NSError *error) {
        NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"LiveHeader"];
        if (data) {
            [self dealDictionaryData:data];
        }
        [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"ServerBusy")];
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        
    }];
}
-(void)dealDictionaryData:(NSData *)data
{
    NSDictionary *dic = [data mj_JSONObject];
    [CNLiveModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
        return @{ @"ID" : @"id" ,@"Description" : @"description" };
    }];
    self.liveModel = [CNLiveModel mj_objectWithKeyValues:dic];
    self.header.model = [CNLiveModel mj_objectWithKeyValues:dic];
    [self.tableView reloadData];
}
- (void)loadData{
    NSString *strUrl = REQUESTURL(@"gxb/api/cataloglatest");
    NSLog(@"%@",strUrl);
    NSString *josnParameters = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"categoryId\":\"spzl/fbhhf/\",\"page\":\"%ld\",\"pageSize\":\"%@\"}",(long)self.pageNo,REQUEST_PAGE_SIZE];
    NSLog(@"%@",josnParameters);
    NSDictionary *parameters = @{@"params":josnParameters};
    NSLog(@"%@",parameters);

    if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
        NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"liveList"];
        if (data && self.pageNo == 1) {
            [self dealDictionaryListData:data];
        }
        [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"NetworkiInterruption")];
        [self.tableView.mj_header endRefreshing];
        [self.tableView.mj_footer endRefreshing];
        self->_isRefreshing = NO;
        return;
    }
    
    [AlertViewTool showHUDView];

    [XWHTTPTool POST:strUrl params:parameters success:^(id json) {
        [AlertViewTool hideHUDView];

        // 请求成功,解析数据
        NSDictionary *dic = [NSDictionary dictionaryWithDictionary:json];
        
        if ([dic[@"errorCode"] isEqualToString:@"0"]) {
            NSData *data = [dic mj_JSONData];
            if ( self.pageNo ==1 ) {
                [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"liveList"];
            }
            [self dealDictionaryListData:data];
            
        } else {
            NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"liveList"];
            if (data && self.pageNo == 1) {
                [self dealDictionaryListData:data];
            }
            [AlertViewTool showHUDAddedToView:self.view text:dic[@"errorMessage"]];
            
        }
        [self.tableView.mj_header endRefreshing];

        if ([dic[@"nextCursor"] isEqualToString:@"0"]) {
            [self.tableView.mj_footer endRefreshingWithNoMoreData];
            
        } else {
            [self.tableView.mj_footer endRefreshing];
            
        }
        
        self->_isRefreshing = NO;

        
    } failure:^(NSError *error) {
        NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"liveList"];
        if (data && self.pageNo == 1) {
            [self dealDictionaryListData:data];
        }
        self->_isRefreshing = NO;
        [AlertViewTool hideHUDView];
        [AlertViewTool showHUDViewText:CustomStr(@"ServerBusy")];
        [self.tableView.mj_header endRefreshing];
        [self.tableView.mj_footer endRefreshing];

    }];
}
-(void)dealDictionaryListData:(NSData *)data{
    NSDictionary *dic = [data mj_JSONObject];
    if ([dic[@"programs"] isKindOfClass:[NSArray class]]) {
        self->_newsArray = dic[@"programs"];
        NSArray *lists = dic[@"programs"];
        
        if(self->_pageNo == 1&&lists.count > 0){
            [self.data removeAllObjects];
            
        }
        self->_pageNo++;

        for (NSDictionary *dics in lists) {
            [CNLiveModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
                return @{ @"ID" : @"id" ,@"Description" : @"description" };
            }];
            
            NSLog(@"%@",dics);
            [self.data addObject:[CNLiveModel mj_objectWithKeyValues:dics]];
            
        }
        
    }
    [self.tableView reloadData];
}
- (void)loadYGData {
        NSString *strUrl = REQUESTURL(@"gxb/api/cataloglatest");
        //NSLog(@"%@",strUrl);
        NSString *categoryId = [NSString stringWithFormat:@"{\"plat\":\"i\",\"version\":\"5.0\",\"appid\":\"gxb\",\"categoryId\":\"wz/fbhgg/\",\"page\":\"1\",\"pageSize\":\"1\"}"];
        //NSLog(@"%@",categoryId);
        if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
            [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")];
            return;
        }
        NSDictionary *parameters = @{@"params":categoryId};
        AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
        [manager POST:strUrl parameters:parameters headers:nil  progress:^(NSProgress * _Nonnull uploadProgress) {} success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary *responseObject) {
            // 请求成功,解析数据
            self->_dictionary = [NSDictionary dictionaryWithDictionary:responseObject];
        }
         failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
             // 请求失败
             [AlertViewTool showHUDViewText:CustomStr(@"ServerBusy")];
             
         }];
}
- (void)loadUpData{
    _pageNo = 1;
    if(!_isRefreshing){
        _isRefreshing = YES;
        [self loadYGData];
        [self loadData];
        if(!_isLoaded){
            [self getData];
        }
    }
}
- (void)loadMoreData{
    if(!_isRefreshing){
        _isRefreshing = YES;
        [self loadData];
    }
//    [self.tableView.mj_footer endRefreshing];
//    [AlertViewTool showHUDViewText:@"查看往期发布会回放,请点击搜索按钮" block:nil duration:1.5];
    
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    //直播开始统计
    [CNLiveStat statLivePlayerWithChannelId:@"zbsc"];
    [CNLiveStat beginEvent:@"zbsc"];
    
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]};
    [self.navigationController setNavigationBarHidden:NO];

}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpNavigationBar];
    [self getData];
    
    _pageNo = 1;
    _isRefreshing = NO;
    _isLoaded = NO;
    [self loadData];
    [self loadYGData];
    [self.view addSubview:self.tableView];
    self.tableView.tableHeaderView = self.header;
    __weak typeof(self) weakSelf = self;
    
    __block CNLiveViewController *  blockSelf = self;
    _header.block = ^() {
        if([weakSelf.liveModel.status isEqualToString:@"2"]||[weakSelf.liveModel.status isEqualToString:@"-2"]){
            return;
        }
        NSDictionary *dic = [weakSelf.liveModel toDictionary];
        GraphicLiveViewController *vc = [[GraphicLiveViewController alloc] initWithDictionary:dic];
        vc.relatedArray = [NSArray arrayWithArray:blockSelf->_newsArray];
        vc.hidesBottomBarWhenPushed = YES;
        [weakSelf.navigationController pushViewController:vc animated:YES];
        return;
    };

    // Do any additional setup after loading the view.
}
- (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    //时长统计结束
    [CNLiveStat endEvent:@"zbsc"];
}
#pragma mark - UI
- (void)setUpNavigationBar{

    //左
    UIButton *headerButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
    headerButton.userInteractionEnabled = NO;
    headerButton.layer.cornerRadius = 2.0;
    headerButton.layer.masksToBounds = true;
    [headerButton setImage:[UIImage imageNamed:@"cnlive_icon"] forState:UIControlStateNormal];
    [headerButton setTitle:@"直播" forState:UIControlStateNormal];
    if (HOMETITLECOLORSTR) {
        [headerButton setTitleColor:[UIColor colorWithHexString:HOMETITLECOLORSTR] forState:UIControlStateNormal];
    }else{
    [headerButton setTitleColor:Color_Blue forState:UIControlStateNormal];
    }
    headerButton.titleLabel.font = [UIFont systemFontOfSize:15];
    
    headerButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;//居左显示
    headerButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:headerButton];
    
    //右
    UIButton *searchButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 23, 44)];
    [searchButton setImage:[UIImage imageNamed:@"cnlive_blue_search"] forState:UIControlStateNormal];
//    [searchButton setBackgroundImage:[UIImage imageNamed:@"cnlive_search"] forState:UIControlStateNormal];
    [searchButton addTarget:self action:@selector(clickedSearchBtn:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithCustomView:searchButton];
    
    UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    space.width = 15;
    
    UIButton *languageButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 23, 44)];
    if(IS_CHINESE){
        [languageButton setImage:[UIImage imageNamed:@"cnlive_EN"] forState:UIControlStateNormal];
        [languageButton setImage:[UIImage imageNamed:@"cnlive_CN"] forState:UIControlStateSelected];
    }else{
        [languageButton setImage:[UIImage imageNamed:@"cnlive_CN"] forState:UIControlStateNormal];
        [languageButton setImage:[UIImage imageNamed:@"cnlive_EN"] forState:UIControlStateSelected];
    }
    
    [languageButton addTarget:self action:@selector(chinaENLanguageSwitch:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithCustomView:languageButton];
    self.navigationItem.rightBarButtonItems = @[item2, space, item1];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.section == 0){
        return 100;
        
    }else if (indexPath.section == 1){
        return 40;
        
    }
    return 95*MainScale+10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.00000001f;

}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    if(section == 0){
        return 10;
    }else if(section == 1){
        return 5;
    }
    return 0.00000001f;

}

#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
    
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if(section == 0){
        return 1;
        
    }else if (section == 1){
        return 1;
        
    }
    return self.data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.section == 0){
        CNLiveIndicatorTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indicatorTableViewCell];
        if (!cell) {
            cell = [[CNLiveIndicatorTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indicatorTableViewCell];
        }
        cell.model = self.liveModel;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
        
    }else if (indexPath.section == 1){
        CNLiveIndicatorTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indicatorTableViewCell];
        if (!cell) {
            cell = [[CNLiveIndicatorTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indicatorTableViewCell];
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.type = @"查看发布会预告";
        return cell;
    }

    CNLiveTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:liveTableViewCell];
    if (!cell) {
        cell = [[CNLiveTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:liveTableViewCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.data[indexPath.row];
    return cell;
    
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//    if(section == 2){
//        UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, MainScreenWidth, 40)];
//        headerView.backgroundColor = [UIColor whiteColor];
//        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, MainScreenWidth-20, 40)];
//        titleLabel.backgroundColor = [UIColor whiteColor];
//        titleLabel.textColor = HEXCOLOR(0x333333);
//        titleLabel.font = [UIFont systemFontOfSize:15];
//        titleLabel.text = @"发布会回放";
//        [headerView addSubview:titleLabel];
//        return headerView;
//    }
    
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, MainScreenWidth, 0.000001f)];
    headerView.backgroundColor = HEXCOLOR(0xebebeb);
    return headerView;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, MainScreenWidth, 10)];
    headerView.backgroundColor = HEXCOLOR(0xebebeb);
    return headerView;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if(indexPath.section == 0){
        if([self.header.model.status isEqualToString:@"2"]||[self.header.model.status isEqualToString:@"-2"]){
            return;
        }
        NSDictionary *dic = [self.liveModel toDictionary];
        GraphicLiveViewController *vc = [[GraphicLiveViewController alloc] initWithDictionary:dic];
        vc.relatedArray = [NSArray arrayWithArray:_newsArray];
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
        return;

    }else if (indexPath.section == 1){
        //查看发布会预告
        TopNoticeViewController *vc = [[TopNoticeViewController alloc] init];
        vc.forecaseDic = _dictionary;
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];
        return;
    }
    
    CNLiveModel *model = self.data[indexPath.row];
    NSDictionary *dic = [model toDictionary];

//    if ([model.videoFlag isEqualToString:@"0"]){
//        //查看发布会预告
//        OldArticleDetailViewController *vc = [[OldArticleDetailViewController alloc] initWithDictionary:dic];
//        vc.title = dic[@"cmsColumnName"];
//        vc.hidesBottomBarWhenPushed = YES;
//        [self.navigationController pushViewController:vc animated:YES];
//        return;
//    }

    VideoPlayBackViewController *vc = [[VideoPlayBackViewController alloc] initWithDictionary:dic];
    vc.title = model.cmsColumnName;
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */
#pragma mark - Action
- (void)clickedSearchBtn:(UIButton *)btn{
    CNLiveSearchViewController *search = [[CNLiveSearchViewController alloc] init];
    search.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:search animated:YES];
}

#pragma mark - Lazy Laoding
- (UITableView *)tableView{
    if(!_tableView){
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, MainScreenWidth, MainScreenHeight-NavBarHeight-TabBarHeight) style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor = HEXCOLOR(0xebebeb);
        _tableView.estimatedRowHeight = 0;
        _tableView.estimatedSectionHeaderHeight = 0;
        _tableView.estimatedSectionFooterHeight = 0;
        
        [_tableView registerClass:[CNLiveTableViewCell class] forCellReuseIdentifier:liveTableViewCell];
        [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:tableViewCell];
        [_tableView registerClass:[CNLiveIndicatorTableViewCell class] forCellReuseIdentifier:indicatorTableViewCell];

        //  设置上拉加载
        MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadUpData)];
        NSMutableArray *refreshingImages = [NSMutableArray array];
        for (NSUInteger i = 0; i < 4; i++) {
            UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"refresh_animation%lu", (unsigned long)i]];
            [refreshingImages addObject:image];
        }
        [header setImages:refreshingImages forState:MJRefreshStateRefreshing];
        header.lastUpdatedTimeLabel.hidden = YES;
        header.stateLabel.hidden = YES;
        _tableView.mj_header = header;

        //  设置下拉刷新
        MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
        [footer setTitle:CustomStr(@"RefreshBackFooterIdleText") forState:MJRefreshStateIdle];
        [footer setTitle:CustomStr(@"RefreshBackFooterPullingText") forState:MJRefreshStatePulling];
        [footer setTitle:CustomStr(@"RefreshBackFooterRefreshingText") forState:MJRefreshStateRefreshing];
        [footer setTitle:CustomStr(@"RefreshBackFooterNoMoreDataText") forState:MJRefreshStateNoMoreData];
//        [footer setTitle:CustomStr(@"RefreshBackFooterNoMoreDataText") forState:MJRefreshStateIdle];
//        [footer setTitle:CustomStr(@"RefreshBackFooterNoMoreDataText") forState:MJRefreshStatePulling];
//        [footer setTitle:CustomStr(@"RefreshBackFooterNoMoreDataText") forState:MJRefreshStateRefreshing];
//        [footer setTitle:CustomStr(@"RefreshBackFooterNoMoreDataText") forState:MJRefreshStateNoMoreData];
        _tableView.mj_footer = footer;
        
    }
    return _tableView;
}
- (CNLiveHeaderView *)header{
    if(!_header){
        _header = [[CNLiveHeaderView alloc]initWithFrame:CGRectMake(0, 0, MainScreenWidth, MainScreenWidth*9 /16)];
        _header.backgroundColor = Color_Blue;
    }
    return _header;
}
- (NSMutableArray *)data{
    if(!_data){
        _data = [[NSMutableArray alloc] init];
    }
    return _data;
}
- (CNLiveModel *)liveModel{
    if(!_liveModel){
        _liveModel = [[CNLiveModel alloc] init];
    }
    return _liveModel;
}
@end