Skip to content

Commit 80e8fee

Browse files
FIX: Issue with animationDuration.
1 parent 03ff4fd commit 80e8fee

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

GraphKit/Example/ExampleBarGraphVC.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ - (void)viewDidLoad {
3232
// self.graphView.barWidth = 22;
3333
// self.graphView.barHeight = 140;
3434
// self.graphView.marginBar = 25;
35+
// self.graphView.animationDuration = 2.0;
3536

36-
self.graphView.animationDuration = 2.0;
3737
self.graphView.dataSource = self;
3838

3939
[self.graphView draw];

Source/BarGraph/GKBar.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#import "UIColor+GraphKit.h"
1414

15+
static CFTimeInterval kDefaultAnimationDuration = 1.0;
16+
1517
@interface GKBar ()
1618

1719
@property (atomic, assign) BOOL animationInProgress;
@@ -47,7 +49,7 @@ - (id)initWithFrame:(CGRect)frame {
4749

4850
- (void)_init {
4951
self.animated = YES;
50-
self.animationDuration = 0.5;
52+
self.animationDuration = kDefaultAnimationDuration;
5153
self.clipsToBounds = YES;
5254
self.cornerRadius = 2.0;
5355
self.foregroundColor = [UIColor gk_turquoiseColor];

Source/BarGraph/GKBarGraph.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
@property (nonatomic, assign) CGFloat marginBar;
2727

2828
- (void)draw;
29-
//- (void)construct;
30-
//- (instancetype)draw;
3129
- (void)reset;
3230

3331
@end

Source/BarGraph/GKBarGraph.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
static CGFloat kDefaultLabelWidth = 40;
2020
static CGFloat kDefaultLabelHeight = 15;
2121

22+
static CGFloat kDefaultAnimationDuration = 2.0;
23+
2224
@implementation GKBarGraph
2325

2426
- (id)initWithCoder:(NSCoder *)aDecoder {
@@ -39,6 +41,7 @@ - (id)initWithFrame:(CGRect)frame {
3941
}
4042

4143
- (void)_init {
44+
self.animationDuration = kDefaultAnimationDuration;
4245
self.barHeight = kDefaultBarHeight;
4346
self.barWidth = kDefaultBarWidth;
4447
self.marginBar = kDefaultBarMargin;
@@ -66,11 +69,11 @@ - (void)setBarColor:(UIColor *)color {
6669
}
6770

6871
- (void)draw {
69-
[self construct];
72+
[self _construct];
7073
[self _drawBars];
7174
}
7275

73-
- (void)construct {
76+
- (void)_construct {
7477
NSAssert(self.dataSource, @"GKBarGraph : No data source is assgined.");
7578

7679
if ([self _hasBars]) [self _removeBars];
@@ -83,10 +86,6 @@ - (void)construct {
8386
[self _positionLabels];
8487
}
8588

86-
//- (void)_construct {
87-
//
88-
//}
89-
9089
- (BOOL)_hasBars {
9190
return ![self.bars mk_isEmpty];
9291
}

0 commit comments

Comments
 (0)