Skip to content

Commit

Permalink
Merge pull request #3 from bguidolim/loader-color
Browse files Browse the repository at this point in the history
Added startLoaderWithTintColor:
  • Loading branch information
rounak committed Feb 24, 2015
2 parents 39cabf4 + a64f8b8 commit 8a65c40
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Example/RJImageLoader/RJViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ @implementation RJViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self.imageView startLoader];
[self.imageView startLoaderWithTintColor:[UIColor blueColor]];
__weak typeof(self)weakSelf = self;
[self.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.hdwallpapersinn.com/wp-content/uploads/2014/08/cute-cat-wallpapers.jpg"] placeholderImage:nil options:SDWebImageCacheMemoryOnly | SDWebImageRefreshCached progress:^(NSInteger receivedSize, NSInteger expectedSize) {
[weakSelf.imageView updateImageDownloadProgress:(CGFloat)receivedSize/expectedSize];
Expand Down
8 changes: 7 additions & 1 deletion Pod/Classes/RJCircularLoaderView.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ - (instancetype)initWithFrame:(CGRect)frame
_circlePathLayer.frame = self.bounds;
_circlePathLayer.lineWidth = 2;
_circlePathLayer.fillColor = [UIColor clearColor].CGColor;
_circlePathLayer.strokeColor = [UIColor redColor].CGColor;
_circlePathLayer.strokeStart = 0;
_circlePathLayer.strokeColor = self.tintColor.CGColor;
_circlePathLayer.strokeEnd = _progress;
[self.layer addSublayer:_circlePathLayer];
self.backgroundColor = [UIColor whiteColor];
Expand All @@ -58,6 +58,12 @@ - (void)layoutSubviews
self.circlePathLayer.path = self.circlePath;
}

- (void)tintColorDidChange
{
[super tintColorDidChange];
self.circlePathLayer.strokeColor = self.tintColor.CGColor;
}

- (void)reveal
{
self.backgroundColor = [UIColor clearColor];
Expand Down
1 change: 1 addition & 0 deletions Pod/Classes/UIImageView+RJLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

- (void)updateImageDownloadProgress:(CGFloat)progress;
- (void)startLoader;
- (void)startLoaderWithTintColor:(UIColor *)color;
- (void)reveal;

@end
6 changes: 6 additions & 0 deletions Pod/Classes/UIImageView+RJLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ - (void)startLoader
loaderView.progress = 0;
}

- (void)startLoaderWithTintColor:(UIColor *)color
{
[self startLoader];
self.rj_circularLoaderView.tintColor = color;
}

- (void)reveal
{
[self.rj_circularLoaderView reveal];
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Rounak Jain.
Follow me on Twitter [@r0unak](https://twitter.com/r0unak)
##Contributors
[@bguidolim](http://twitter.com/bguidolim)
## License
RJImageLoader is available under the MIT license. See the LICENSE file for more info.
Expand Down
8 changes: 4 additions & 4 deletions RJImageLoader.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |s|
s.name = "RJImageLoader"
s.version = "0.1.0"
s.version = "0.2.0"
s.summary = "A neat image loader for iOS based on Michael Villar's design."
s.description = <<-DESC
RJImageLoader is a category on UIImageView that lets you add a circular progress and reveal animation when loading images from the network. It is agnostic to the image download process, has a simple interface, and is very easy to integrate.
Expand All @@ -25,9 +25,9 @@ Pod::Spec.new do |s|
s.requires_arc = true

s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'RJImageLoader' => ['Pod/Assets/*.png']
}
#s.resource_bundles = {
# 'RJImageLoader' => ['Pod/Assets/*.png']
#}

# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
Expand Down