@@ -13,7 +13,6 @@ @interface CCActivityHUD ()
13
13
@property (strong , nonatomic ) CAShapeLayer *indicatorCAShapeLayer;
14
14
@property (strong , nonatomic ) UIImageView *imageView;
15
15
16
- @property (strong , nonatomic ) UIColor *updatedColor;
17
16
@property CCActivityHUDIndicatorType currentTpye;
18
17
@property BOOL useProvidedIndicator;
19
18
@property BOOL useProgress;
@@ -47,10 +46,6 @@ - (void)setCornerRadius:(CGFloat)cornerRadius {
47
46
}
48
47
}
49
48
50
- - (void )setIndicatorColor : (UIColor *)indicatorColor {
51
- self.updatedColor = indicatorColor;
52
- }
53
-
54
49
- (void )setProgress : (CGFloat)progress {
55
50
if (self.indicatorCAShapeLayer && self.useProgress ) {
56
51
if (progress >= 1 ) {
@@ -79,18 +74,7 @@ - (void)showWithType:(CCActivityHUDIndicatorType)type {
79
74
self.currentTpye = type;
80
75
self.useProvidedIndicator = YES ;
81
76
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
+
94
78
[self communalShowTask ];
95
79
}
96
80
}
@@ -198,9 +182,7 @@ - (void)showWithProgress {
198
182
self.indicatorCAShapeLayer .path = [self arcPathWithStartAngle: -M_PI/2 span: 2 *M_PI];
199
183
self.indicatorCAShapeLayer .strokeEnd = 0.0 ;
200
184
201
- if (self.indicatorCAShapeLayer && self.updatedColor ) {
202
- self.indicatorCAShapeLayer .strokeColor = self.updatedColor .CGColor ;
203
- }
185
+ self.indicatorCAShapeLayer .strokeColor = self.indicatorColor .CGColor ;
204
186
205
187
self.progress = 0.0 ;
206
188
self.useProvidedIndicator = NO ;
@@ -302,6 +284,8 @@ - (instancetype)init {
302
284
self.layer .cornerRadius = 5.0 ;
303
285
304
286
self.isTheOnlyActiveView = YES ;
287
+
288
+ self.indicatorColor = [UIColor whiteColor ];
305
289
306
290
self.appearAnimationType = CCActivityHUDAppearAnimationTypeFadeIn;
307
291
self.disappearAnimationType = CCActivityHUDDisappearAnimationTypeFadeOut;
@@ -368,7 +352,7 @@ - (void)initializeScalingDots {
368
352
CGFloat length = ViewFrameWidth*18 /200 ;
369
353
370
354
self.indicatorCAShapeLayer = [[CAShapeLayer alloc ] init ];
371
- self.indicatorCAShapeLayer .backgroundColor = [UIColor whiteColor ] .CGColor ;
355
+ self.indicatorCAShapeLayer .backgroundColor = self. indicatorColor .CGColor ;
372
356
self.indicatorCAShapeLayer .frame = CGRectMake (0 , 0 , length, length);
373
357
self.indicatorCAShapeLayer .position = CGPointMake (ViewFrameWidth/2 , ViewFrameHeight/5 );
374
358
self.indicatorCAShapeLayer .cornerRadius = length/2 ;
@@ -386,7 +370,7 @@ - (void)initializeLeadingDots {
386
370
CGFloat length = ViewFrameWidth*25 /200 ;
387
371
388
372
self.indicatorCAShapeLayer = [[CAShapeLayer alloc ] init ];
389
- self.indicatorCAShapeLayer .backgroundColor = [UIColor whiteColor ] .CGColor ;
373
+ self.indicatorCAShapeLayer .backgroundColor = self. indicatorColor .CGColor ;
390
374
self.indicatorCAShapeLayer .frame = CGRectMake (0 , 0 , length, length);
391
375
self.indicatorCAShapeLayer .position = CGPointMake (ViewFrameWidth/2 , ViewFrameHeight/5 );
392
376
self.indicatorCAShapeLayer .cornerRadius = length/2 ;
@@ -401,7 +385,7 @@ - (void)initializeLeadingDots {
401
385
402
386
- (void )initializeMinorArc {
403
387
self.indicatorCAShapeLayer = [[CAShapeLayer alloc ] init ];
404
- self.indicatorCAShapeLayer .strokeColor = [UIColor whiteColor ] .CGColor ;
388
+ self.indicatorCAShapeLayer .strokeColor = self. indicatorColor .CGColor ;
405
389
self.indicatorCAShapeLayer .fillColor = [UIColor clearColor ].CGColor ;
406
390
self.indicatorCAShapeLayer .lineWidth = ViewFrameWidth/24 ;
407
391
@@ -429,7 +413,7 @@ - (void)initializeSpringBall {
429
413
CGFloat length = ViewFrameWidth*38 /200 ;
430
414
431
415
self.indicatorCAShapeLayer = [[CAShapeLayer alloc ] init ];
432
- self.indicatorCAShapeLayer .backgroundColor = [UIColor whiteColor ] .CGColor ;
416
+ self.indicatorCAShapeLayer .backgroundColor = self. indicatorColor .CGColor ;
433
417
self.indicatorCAShapeLayer .frame = CGRectMake (0 , 0 , length, length);
434
418
self.indicatorCAShapeLayer .position = CGPointMake (ViewFrameWidth/2 , ViewFrameHeight/5 );
435
419
self.indicatorCAShapeLayer .cornerRadius = length/2 ;
@@ -439,7 +423,7 @@ - (void)initializeScalingBars {
439
423
self.replicatorLayer .instanceCount = 5 ;
440
424
441
425
self.indicatorCAShapeLayer = [[CAShapeLayer alloc ] init ];
442
- self.indicatorCAShapeLayer .backgroundColor = [UIColor whiteColor ] .CGColor ;
426
+ self.indicatorCAShapeLayer .backgroundColor = self. indicatorColor .CGColor ;
443
427
CGFloat padding = 10 ;
444
428
self.indicatorCAShapeLayer .frame = CGRectMake (padding, ViewFrameHeight/4 ,(ViewFrameWidth-padding*2 )*2 /3 /self.replicatorLayer .instanceCount , ViewFrameHeight/2 );
445
429
self.indicatorCAShapeLayer .cornerRadius = FrameWidthFor (self.indicatorCAShapeLayer )/2 ;
@@ -452,7 +436,7 @@ - (void)initializeTriangleCircle {
452
436
CGFloat length = ViewFrameWidth*25 /200 ;
453
437
454
438
self.indicatorCAShapeLayer = [[CAShapeLayer alloc ] init ];
455
- self.indicatorCAShapeLayer .backgroundColor = [UIColor whiteColor ] .CGColor ;
439
+ self.indicatorCAShapeLayer .backgroundColor = self. indicatorColor .CGColor ;
456
440
self.indicatorCAShapeLayer .frame = CGRectMake (0 , 0 , length, length);
457
441
self.indicatorCAShapeLayer .position = CGPointMake (ViewFrameWidth/2 , ViewFrameHeight/5 );
458
442
self.indicatorCAShapeLayer .cornerRadius = length/2 ;
0 commit comments