RankingViewController.m
3.57 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
//
// RankingViewController.m
// LifeLog
//
// Created by Nguyen Van Phong on 7/25/17.
// Copyright © 2017 PhongNV. All rights reserved.
//
#import "RankingViewController.h"
#import "RankingTableViewCell.h"
@interface RankingViewController ()
@end
@implementation RankingViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.title = NSLocalizedString(@"lifelog.rank.title", nil);
[self setupView];
//register nib for table view
[self.tableRank registerNib:[UINib nibWithNibName:@"RankingTableViewCell" bundle:nil] forCellReuseIdentifier:@"RankCell"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark Setup and Update View
- (void)setupView {
NSArray *timeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.time.1", nil), NSLocalizedString(@"lifelog.rank.time.2", nil), NSLocalizedString(@"lifelog.rank.time.3", nil), NSLocalizedString(@"lifelog.rank.time.4", nil), nil];
[self.viewCollectionTime setButtonNumber:timeTitle.count];
[self.viewCollectionTime setSpacing:1];
[self.viewCollectionTime setArrayTitle:timeTitle];
self.viewCollectionTime.changeCurrentIndex = ^(int index){
[self callRequestToUpdateData];
};
NSArray *modeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.mode.1", nil), NSLocalizedString(@"lifelog.rank.mode.2", nil), NSLocalizedString(@"lifelog.rank.mode.3", nil), NSLocalizedString(@"lifelog.rank.mode.4", nil), nil];
[self.viewCollectionMode setButtonNumber:modeTitle.count];
[self.viewCollectionMode setSpacing:1];
[self.viewCollectionMode setArrayTitle:modeTitle];
self.viewCollectionMode.changeCurrentIndex = ^(int index){
[self callRequestToUpdateData];
};
NSArray *typeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.rank.type.1", nil), NSLocalizedString(@"lifelog.rank.type.2", nil), NSLocalizedString(@"lifelog.rank.type.3", nil), NSLocalizedString(@"lifelog.rank.type.4", nil), nil];
[self.viewCollectionType setButtonNumber:typeTitle.count];
[self.viewCollectionType setSpacing:1];
[self.viewCollectionType setArrayTitle:typeTitle];
self.viewCollectionMode.changeCurrentIndex = ^(int index){
[self callRequestToUpdateData];
};
}
#pragma mark IBAction function
- (IBAction)clickButton:(UIButton *)sender {
}
#pragma mark UITableView Delegate
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
// if(_curHisList == nil || _curHisList.count == 0) {
// UILabel * noDataLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, tableView.frame.size.height)];
// noDataLabel.text = @"No data available";
// noDataLabel.backgroundColor = [UIColor clearColor];
// noDataLabel.textColor = [UIColor whiteColor];
// noDataLabel.textAlignment = NSTextAlignmentCenter;
// tableView.backgroundView = noDataLabel;
// tableView.backgroundView.layer.zPosition -= 1;
// return 0;
// }
// tableView.backgroundView = nil;
return 1;
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 6;
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
RankingTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RankCell"];
return cell;
}
#pragma mark Private function
- (void)callRequestToUpdateData {
}
@end