Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

Commit 73831e3

Browse files
committed
fix issue#4
1 parent c51c52c commit 73831e3

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

CCActivityHUD.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'CCActivityHUD'
33
spec.platform = :ios
4-
spec.version = '2.1.6'
4+
spec.version = '2.1.7'
55
spec.license = { :type => 'MIT' }
66
spec.homepage = 'https://github.com/Cokile/CCActivityHUD'
77
spec.authors = { 'Cokile' => '[email protected]' }
88
spec.summary = 'A simple replacement for UIActivityIndicatorView'
9-
spec.source = {:git => 'https://github.com/Cokile/CCActivityHUD.git', :tag => 'v2.1.6'}
9+
spec.source = {:git => 'https://github.com/Cokile/CCActivityHUD.git', :tag => 'v2.1.7'}
1010
spec.source_files = 'CCActivityHUD/*.{h,m}'
1111
spec.resources = 'CCActivityHUD/*.png'
1212
spec.frameworks = 'ImageIO'

CCActivityHUD/CCActivityHUD.m

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ @interface CCActivityHUD ()
1313
@property (strong, nonatomic) CAShapeLayer *indicatorCAShapeLayer;
1414
@property (strong, nonatomic) UIImageView *imageView;
1515

16-
@property (strong, nonatomic) UIColor *updatedColor;
1716
@property CCActivityHUDIndicatorType currentTpye;
1817
@property BOOL useProvidedIndicator;
1918
@property BOOL useProgress;
@@ -47,10 +46,6 @@ - (void)setCornerRadius:(CGFloat)cornerRadius {
4746
}
4847
}
4948

50-
- (void)setIndicatorColor:(UIColor *)indicatorColor {
51-
self.updatedColor = indicatorColor;
52-
}
53-
5449
- (void)setProgress:(CGFloat)progress {
5550
if (self.indicatorCAShapeLayer && self.useProgress) {
5651
if (progress >= 1) {
@@ -79,18 +74,7 @@ - (void)showWithType:(CCActivityHUDIndicatorType)type {
7974
self.currentTpye = type;
8075
self.useProvidedIndicator = YES;
8176
self.useProgress = NO;
82-
83-
// change the indicator color if user do not use the default color.
84-
// You will confused that why not change the indicator color within the relevant setter,
85-
// If so, I need to initialize self.indicatorCAShapeLayer in the init method,
86-
// However, this will cause a problem (or bug) that the animation not works,
87-
// Meanwhile, when user use GIF instead of provided animation types,
88-
// the init method will create two useless instances,
89-
// since showing GIF not rely on self.indicatorCAShapeLayer
90-
if (self.indicatorCAShapeLayer && self.updatedColor) {
91-
self.indicatorCAShapeLayer.strokeColor = self.updatedColor.CGColor;
92-
}
93-
77+
9478
[self communalShowTask];
9579
}
9680
}
@@ -198,9 +182,7 @@ - (void)showWithProgress {
198182
self.indicatorCAShapeLayer.path = [self arcPathWithStartAngle:-M_PI/2 span:2*M_PI];
199183
self.indicatorCAShapeLayer.strokeEnd = 0.0;
200184

201-
if (self.indicatorCAShapeLayer && self.updatedColor) {
202-
self.indicatorCAShapeLayer.strokeColor = self.updatedColor.CGColor;
203-
}
185+
self.indicatorCAShapeLayer.strokeColor = self.indicatorColor.CGColor;
204186

205187
self.progress = 0.0;
206188
self.useProvidedIndicator = NO;
@@ -302,6 +284,8 @@ - (instancetype)init {
302284
self.layer.cornerRadius = 5.0;
303285

304286
self.isTheOnlyActiveView = YES;
287+
288+
self.indicatorColor = [UIColor whiteColor];
305289

306290
self.appearAnimationType = CCActivityHUDAppearAnimationTypeFadeIn;
307291
self.disappearAnimationType = CCActivityHUDDisappearAnimationTypeFadeOut;
@@ -368,7 +352,7 @@ - (void)initializeScalingDots {
368352
CGFloat length = ViewFrameWidth*18/200;
369353

370354
self.indicatorCAShapeLayer = [[CAShapeLayer alloc] init];
371-
self.indicatorCAShapeLayer.backgroundColor = [UIColor whiteColor].CGColor;
355+
self.indicatorCAShapeLayer.backgroundColor = self.indicatorColor.CGColor;
372356
self.indicatorCAShapeLayer.frame = CGRectMake(0, 0, length, length);
373357
self.indicatorCAShapeLayer.position = CGPointMake(ViewFrameWidth/2, ViewFrameHeight/5);
374358
self.indicatorCAShapeLayer.cornerRadius = length/2;
@@ -386,7 +370,7 @@ - (void)initializeLeadingDots {
386370
CGFloat length = ViewFrameWidth*25/200;
387371

388372
self.indicatorCAShapeLayer = [[CAShapeLayer alloc] init];
389-
self.indicatorCAShapeLayer.backgroundColor = [UIColor whiteColor].CGColor;
373+
self.indicatorCAShapeLayer.backgroundColor = self.indicatorColor.CGColor;
390374
self.indicatorCAShapeLayer.frame = CGRectMake(0, 0, length, length);
391375
self.indicatorCAShapeLayer.position = CGPointMake(ViewFrameWidth/2, ViewFrameHeight/5);
392376
self.indicatorCAShapeLayer.cornerRadius = length/2;
@@ -401,7 +385,7 @@ - (void)initializeLeadingDots {
401385

402386
- (void)initializeMinorArc {
403387
self.indicatorCAShapeLayer = [[CAShapeLayer alloc] init];
404-
self.indicatorCAShapeLayer.strokeColor = [UIColor whiteColor].CGColor;
388+
self.indicatorCAShapeLayer.strokeColor = self.indicatorColor.CGColor;
405389
self.indicatorCAShapeLayer.fillColor = [UIColor clearColor].CGColor;
406390
self.indicatorCAShapeLayer.lineWidth = ViewFrameWidth/24;
407391

@@ -429,7 +413,7 @@ - (void)initializeSpringBall {
429413
CGFloat length = ViewFrameWidth*38/200;
430414

431415
self.indicatorCAShapeLayer = [[CAShapeLayer alloc] init];
432-
self.indicatorCAShapeLayer.backgroundColor = [UIColor whiteColor].CGColor;
416+
self.indicatorCAShapeLayer.backgroundColor = self.indicatorColor.CGColor;
433417
self.indicatorCAShapeLayer.frame = CGRectMake(0, 0, length, length);
434418
self.indicatorCAShapeLayer.position = CGPointMake(ViewFrameWidth/2, ViewFrameHeight/5);
435419
self.indicatorCAShapeLayer.cornerRadius = length/2;
@@ -439,7 +423,7 @@ - (void)initializeScalingBars {
439423
self.replicatorLayer.instanceCount = 5;
440424

441425
self.indicatorCAShapeLayer = [[CAShapeLayer alloc] init];
442-
self.indicatorCAShapeLayer.backgroundColor = [UIColor whiteColor].CGColor;
426+
self.indicatorCAShapeLayer.backgroundColor = self.indicatorColor.CGColor;
443427
CGFloat padding = 10;
444428
self.indicatorCAShapeLayer.frame = CGRectMake(padding, ViewFrameHeight/4,(ViewFrameWidth-padding*2)*2/3/self.replicatorLayer.instanceCount, ViewFrameHeight/2);
445429
self.indicatorCAShapeLayer.cornerRadius = FrameWidthFor(self.indicatorCAShapeLayer)/2;
@@ -452,7 +436,7 @@ - (void)initializeTriangleCircle {
452436
CGFloat length = ViewFrameWidth*25/200;
453437

454438
self.indicatorCAShapeLayer = [[CAShapeLayer alloc] init];
455-
self.indicatorCAShapeLayer.backgroundColor = [UIColor whiteColor].CGColor;
439+
self.indicatorCAShapeLayer.backgroundColor = self.indicatorColor.CGColor;
456440
self.indicatorCAShapeLayer.frame = CGRectMake(0, 0, length, length);
457441
self.indicatorCAShapeLayer.position = CGPointMake(ViewFrameWidth/2, ViewFrameHeight/5);
458442
self.indicatorCAShapeLayer.cornerRadius = length/2;

0 commit comments

Comments
 (0)