File tree Expand file tree Collapse file tree 3 files changed +19
-21
lines changed Expand file tree Collapse file tree 3 files changed +19
-21
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,10 @@ - (void)viewDidLoad {
32
32
// self.graphView.barWidth = 22;
33
33
// self.graphView.barHeight = 140;
34
34
// self.graphView.marginBar = 25;
35
- self.graphView .dataSource = self;
36
35
37
- [self .graphView construct ];
38
36
self.graphView .animationDuration = 2.0 ;
37
+ self.graphView .dataSource = self;
38
+
39
39
[self .graphView draw ];
40
40
41
41
self.green = YES ;
Original file line number Diff line number Diff line change 25
25
@property (nonatomic , assign ) CGFloat barWidth;
26
26
@property (nonatomic , assign ) CGFloat marginBar;
27
27
28
- - (instancetype ) redraw ;
29
- - (instancetype )construct ;
30
- - (instancetype )draw ;
31
- - (instancetype )reset ;
28
+ - (void ) draw ;
29
+ // - (void )construct;
30
+ // - (instancetype)draw;
31
+ - (void )reset ;
32
32
33
33
@end
34
34
Original file line number Diff line number Diff line change @@ -65,28 +65,28 @@ - (void)setBarColor:(UIColor *)color {
65
65
}];
66
66
}
67
67
68
- - (instancetype )redraw {
69
- return [[self construct ] draw ];
68
+ - (void )draw {
69
+ [self construct ];
70
+ [self _drawBars ];
70
71
}
71
72
72
- - (instancetype )construct {
73
+ - (void )construct {
73
74
NSAssert (self.dataSource, @" GKBarGraph : No data source is assgined." );
74
75
75
- [self _construct ];
76
- [self _positionBars ];
77
- [self _positionLabels ];
78
-
79
- return self;
80
- }
81
-
82
- - (void )_construct {
83
76
if ([self _hasBars ]) [self _removeBars ];
84
77
if ([self _hasLabels ]) [self _removeLabels ];
85
78
86
79
[self _constructBars ];
87
80
[self _constructLabels ];
81
+
82
+ [self _positionBars ];
83
+ [self _positionLabels ];
88
84
}
89
85
86
+ // - (void)_construct {
87
+ //
88
+ // }
89
+
90
90
- (BOOL )_hasBars {
91
91
return ![self .bars mk_isEmpty ];
92
92
}
@@ -186,7 +186,7 @@ - (void)_positionLabels {
186
186
}];
187
187
}
188
188
189
- - (instancetype ) draw {
189
+ - (void ) _drawBars {
190
190
__block NSInteger idx = 0 ;
191
191
id source = self.dataSource ;
192
192
[self .bars mk_each: ^(GKBar *item) {
@@ -202,14 +202,12 @@ - (instancetype)draw {
202
202
item.percentage = [[source valueForBarAtIndex: idx] doubleValue ];
203
203
idx++;
204
204
}];
205
- return self;
206
205
}
207
206
208
- - (instancetype )reset {
207
+ - (void )reset {
209
208
[self .bars mk_each: ^(GKBar *item) {
210
209
[item reset ];
211
210
}];
212
- return self;
213
211
}
214
212
215
213
@end
You can’t perform that action at this time.
0 commit comments