CNNewsoundViewController.m
4.17 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
//
// 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