Skip to content

Commit

Permalink
Adding property to control dot hiding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Shi committed Mar 17, 2014
1 parent 59a95b7 commit d3af5f2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Classes/BEMAnimations.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
#import "BEMLine.h"



@class BEMAnimations;
@protocol BEMAnimationDelegate <NSObject>

@optional
- (BOOL)animationDelegateShouldHideDot:(BEMAnimations *)animationDelegate;

@end


Expand Down
12 changes: 9 additions & 3 deletions Classes/BEMAnimations.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ - (void)animationForDot:(NSInteger)dotIndex circleDot:(BEMCircle *)circleDot ani
[UIView animateWithDuration:0.5 delay:dotIndex/(speed*2.0) options:UIViewAnimationOptionCurveEaseOut animations:^{
circleDot.alpha = 0.7;
} completion:^(BOOL finished){
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
circleDot.alpha = 0;
} completion:nil];
BOOL shouldHide = YES;
if ([self.delegate respondsToSelector:@selector(animationDelegateShouldHideDot:)]) {
shouldHide = [self.delegate animationDelegateShouldHideDot:self];
}
if (shouldHide) {
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
circleDot.alpha = 0;
} completion:nil];
}
}];
}
}
Expand Down
3 changes: 3 additions & 0 deletions Classes/BEMSimpleLineGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@

@property (strong, nonatomic) UIColor *colorDot;

// Defaults to YES.
@property (nonatomic) BOOL shouldHideDots;



@end
Expand Down
7 changes: 7 additions & 0 deletions Classes/BEMSimpleLineGraphView.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ - (void)commonInit {
_widthLine = 1.0;
_enableTouchReport = NO;
_enableBezierCurve = NO;
_shouldHideDots = YES;

// Initialize the arrays
xAxisValues = [NSMutableArray array];
Expand Down Expand Up @@ -618,6 +619,12 @@ - (CGFloat)minValue {
return minValue;
}

#pragma mark - BEMAnimationDelegate Methods

- (BOOL)animationDelegateShouldHideDot:(BEMAnimations *)animationDelegate {
return self.shouldHideDots;
}

#pragma mark - Other Methods

- (void)printDeprecationWarningForOldMethod:(NSString *)oldMethod andReplacementMethod:(NSString *)replacementMethod {
Expand Down

0 comments on commit d3af5f2

Please sign in to comment.