Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AAPullToRefresh/AAPullToRefresh.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ typedef NS_ENUM(NSUInteger, AAPullToRefreshPosition) {
@property (nonatomic, assign) CGFloat threshold;
@property (nonatomic, strong) UIImage *imageIcon;
@property (nonatomic, strong) UIColor *borderColor;
@property (nonatomic, strong) UIColor *inactiveBorderColor;
@property (nonatomic, assign) CGFloat borderWidth;

- (id)initWithImage:(UIImage *)image position:(AAPullToRefreshPosition)position;
Expand Down
20 changes: 19 additions & 1 deletion AAPullToRefresh/AAPullToRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ @interface AAPullToRefreshBackgroundLayer : CALayer

@property (nonatomic, assign) CGFloat outlineWidth;
@property (nonatomic, assign, getter = isGlow) BOOL glow;
@property (nonatomic, strong) UIColor *inactiveBorderColor;

- (id)initWithBorderWidth:(CGFloat)width;

@end
Expand Down Expand Up @@ -67,7 +69,7 @@ - (void)drawInContext:(CGContextRef)ctx
CGContextFillEllipseInRect(ctx,CGRectInset(self.bounds, self.outlineWidth, self.outlineWidth));

//Draw circle outline
CGContextSetStrokeColorWithColor(ctx, [UIColor colorWithWhite:0.4f alpha:0.9f].CGColor);
CGContextSetStrokeColorWithColor(ctx, self.inactiveBorderColor.CGColor);
CGContextSetLineWidth(ctx, self.outlineWidth);
CGContextStrokeEllipseInRect(ctx, CGRectInset(self.bounds, self.outlineWidth, self.outlineWidth));
}
Expand Down Expand Up @@ -104,6 +106,16 @@ @interface AAPullToRefresh()

@implementation AAPullToRefresh

- (void)setInactiveBorderColor:(UIColor *)inactiveBorderColor
{
self.backgroundLayer.inactiveBorderColor = inactiveBorderColor;
}

- (UIColor*)inactiveBorderColor
{
return self.backgroundLayer.inactiveBorderColor;
}

#pragma mark - init
- (id)initWithImage:(UIImage *)image position:(AAPullToRefreshPosition)position
{
Expand Down Expand Up @@ -139,6 +151,7 @@ - (void)_commonInit
backgroundLayer.frame = self.bounds;
[self.layer addSublayer:backgroundLayer];
self.backgroundLayer = backgroundLayer;
self.inactiveBorderColor = [UIColor colorWithWhite:0.4f alpha:0.9f];

if (!self.imageIcon)
self.imageIcon = [UIImage imageNamed:@"centerIcon"];
Expand Down Expand Up @@ -467,4 +480,9 @@ - (void)setBorderColor:(UIColor *)borderColor
_shapeLayer.strokeColor = _borderColor.CGColor;
}

-(void)dealloc
{
[self.scrollView removeObserver:self forKeyPath:@"contentOffset"];
}

@end