CNNewsoundViewController.m 4.17 KB
//
//  CNNewsoundViewController.m
//  CNLiveScioLive
//
//  Created by CNLive-zxw on 2018/9/17.
//  Copyright © 2018年 CNLive. All rights reserved.
//

#import "CNNewsoundViewController.h"
#import "CNNewsoundListenViewController.h"
#import "CNNewsoundBaseViewController.h"

@interface CNNewsoundViewController ()
@property (nonatomic, strong) ZXWSegmentControl *segmentControl;

@end

@implementation CNNewsoundViewController
#pragma mark - Data
- (void)getData{
    NSMutableArray *controllers = [NSMutableArray array];
    NSArray *titles = @[CustomStr(@"Play"), CustomStr(@"List")];
    
    for(int i = 0; i < titles.count; i++){
//        if(i == 0){
//            CNNewsoundListenViewController *vc = [[CNNewsoundListenViewController alloc] init];
//            [controllers addObject:vc];
//        }else if(i == 1){
//            CNNewsoundBaseViewController *vc = [[CNNewsoundBaseViewController alloc] init];
//            vc.plat = @"a";
//            vc.recommendKey = @"index";
//            vc.latestKey = @"gxzs";
//            vc.pageUUID = @"d6262244-b059-11e6-b220-c7d8a7a18cc4";
//
//            [controllers addObject:vc];
//        }else if(i == 2){
//            CNNewsoundBaseViewController *vc = [[CNNewsoundBaseViewController alloc] init];
//            vc.plat = @"i";
//            vc.recommendKey = @"channelList";
//            vc.latestKey = @"news";
//            vc.pageUUID = @"bca5bdd0-259a-11e8-908c-c7d8a7a18cc4";
//
//            [controllers addObject:vc];
//        }
        if(i == 0){
            CNNewsoundListenViewController *vc = [[CNNewsoundListenViewController alloc] init];
            [controllers addObject:vc];
        }else if(i == 1){
            if(IS_CHINESE){
                CNNewsoundBaseViewController *vc = [[CNNewsoundBaseViewController alloc] init];
                vc.plat = @"a";
                vc.recommendKey = @"index";
                vc.latestKey = @"gxzs";
                vc.pageUUID = @"d6262244-b059-11e6-b220-c7d8a7a18cc4";
                [controllers addObject:vc];

            }else{
                CNNewsoundBaseViewController *vc = [[CNNewsoundBaseViewController alloc] init];
                vc.plat = @"i";
                vc.recommendKey = @"channelList";
                vc.latestKey = @"news";
                vc.pageUUID = @"bca5bdd0-259a-11e8-908c-c7d8a7a18cc4";
                [controllers addObject:vc];
            }
        }
        
    }
    if(controllers.count > 0){
        self.segmentControl.titles = titles;
        self.segmentControl.viewControllers = controllers;
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeLanguageVersion:) name:@"changeLanguageVersion" object:nil];

    self.name = CustomStr(@"VOICEOFSCIO");
    [self getData];
    
    // Do any additional setup after loading the view.
    
}
- (void)changeLanguageVersion:(NSNotification *)notification {
    self.name = CustomStr(@"VOICEOFSCIO");
//    self.segmentControl.titles = @[CustomStr(@"Play"), CustomStr(@"List")];

}
- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"changeLanguageVersion" object:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#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 - Lazy loading
- (ZXWSegmentControl *)segmentControl{
    if (!_segmentControl) {
        _segmentControl = [[ZXWSegmentControl alloc] initStaticTitlesWithFrame:CGRectMake(0, 0, MainScreenWidth, 45)];
        _segmentControl.backgroundColor = [UIColor whiteColor];
        _segmentControl.titleNormalColor = HEXCOLOR(0x333333);
        _segmentControl.titleSelectColor = Color_Blue;
        [_segmentControl setBottomViewColor:Color_Blue];
        _segmentControl.isTitleScale = NO;
        [self.view addSubview:_segmentControl];
    }
    return _segmentControl;
}
@end