@@ -52,8 +52,7 @@ @interface WSProgressHUD ()
5252
5353@property (nonatomic ) BOOL isRotate;
5454
55- @property (nonatomic ) UIInterfaceOrientation currentDeviceOrientation;
56-
55+ @property (nonatomic ) BOOL isTempIndicatorStyle;
5756
5857@end
5958
@@ -85,7 +84,7 @@ @interface WSProgressHUD ()
8584static CGFloat WSProgressHUDDismissDuration = 0.15 ;
8685static CGFloat const WSProgressHUDWidthEdgeOffset = 10 ;
8786static CGFloat const WSProgressHUDHeightEdgeOffset = 8 ;
88- static CGFloat const WSProgressHUDImageTypeWidthEdgeOffset = 30 ;
87+ static CGFloat const WSProgressHUDImageTypeWidthEdgeOffset = 16 ;
8988
9089
9190@implementation WSProgressHUD
@@ -477,9 +476,15 @@ - (void)dismiss
477476 self.hudView .transform = CGAffineTransformIdentity;
478477
479478 [self .overlayView removeFromSuperview ];
479+
480480 self.userInteractionEnabled = NO ;
481+
481482 [self stopIndicatorAnimation ];
483+
484+ // Call drawInRact
482485 [self setNeedsDisplay ];
486+
487+ [self setProgressHUDIndicatorStyle: self .indicatorStyle];
483488 }];
484489}
485490
@@ -537,8 +542,6 @@ - (void)updateSubviewsPosition
537542 } else {
538543 [self updatePositionWithString: string hudBounds: hudBounds];
539544 }
540-
541-
542545}
543546
544547- (void )updatePositionWithString : (NSString *)string hudBounds : (CGRect)bounds
@@ -549,6 +552,7 @@ - (void)updatePositionWithString: (NSString *)string hudBounds: (CGRect)bounds
549552 self.hudView .bounds = bounds;
550553 self.labelView .frame = WSProgressHUDStringRect;// Reset the view frame
551554 self.hudView .center = CGPointMake (centerX, centerY);
555+ self.hudView .backgroundColor = [UIColor colorWithWhite: 0 alpha: 0.8 ];
552556
553557 CGFloat hudCenterX = CGRectGetWidth (bounds)/2 ;
554558 CGFloat hudCenterY = CGRectGetHeight (bounds)/2 ;
@@ -559,11 +563,28 @@ - (void)updatePositionWithString: (NSString *)string hudBounds: (CGRect)bounds
559563 [self startIndicatorAnimation: YES ];
560564
561565 if (string) {
566+
567+ if (self.indicatorStyle == WSProgressHUDIndicatorGray ||
568+ self.indicatorStyle == WSProgressHUDIndicatorBigGray) {
569+
570+ self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
571+ }
572+
562573 self.labelView .frame = WSProgressHUDStringRect;
563574 self.labelView .center = CGPointMake (hudCenterX + 10 , hudCenterY);
564575 self.spinnerView .center = self.indefiniteAnimationView .center = self.indicatorView .center = CGPointMake (15 , hudCenterY);
565576
566577 } else {
578+
579+ if (self.indicatorStyle == WSProgressHUDIndicatorGray ||
580+ self.indicatorStyle == WSProgressHUDIndicatorBigGray ) {
581+ self.hudView .backgroundColor = [UIColor clearColor ];
582+ if (self.maskType == WSProgressHUDMaskTypeBlack || self.maskType == WSProgressHUDMaskTypeGradient) {
583+ self.indicatorView .color = [UIColor whiteColor ];
584+ } else {
585+ self.indicatorView .color = [UIColor grayColor ];
586+ }
587+ }
567588 self.spinnerView .center = self.indefiniteAnimationView .center = self.indicatorView .center = CGPointMake (hudCenterX, hudCenterY);
568589 }
569590
@@ -856,6 +877,31 @@ - (void)startIndicatorAnimation: (BOOL)start
856877 self.spinnerView .hidden = YES ;
857878 }
858879 }break ;
880+ case WSProgressHUDIndicatorGray: {
881+
882+ self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
883+
884+ self.indefiniteAnimationView .hidden = YES ;
885+ self.spinnerView .hidden = YES ;
886+ if (start) {
887+ [self .indicatorView startAnimating ];
888+ } else {
889+ [self .indicatorView stopAnimating ];
890+ }
891+ }break ;
892+ case WSProgressHUDIndicatorBigGray: {
893+
894+ self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
895+ self.indicatorView .color = [UIColor lightGrayColor ];
896+ self.indefiniteAnimationView .hidden = YES ;
897+ self.spinnerView .hidden = YES ;
898+ if (start) {
899+ [self .indicatorView startAnimating ];
900+ } else {
901+ [self .indicatorView stopAnimating ];
902+ }
903+ }break ;
904+
859905 default :
860906 break ;
861907 }
@@ -1010,6 +1056,18 @@ + (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style {
10101056 [[self shareInstance ] setProgressHUDIndicatorStyle: style];
10111057}
10121058
1059+ + (void )setProgressHUDFont : (UIFont *)font
1060+ {
1061+ [[self shareInstance ] setProgressHUDFont: font];
1062+ }
1063+
1064+ - (void )setProgressHUDFont : (UIFont *)font
1065+ {
1066+ self.labelView .font = self.shimmeringLabel .font = font;
1067+ }
1068+
1069+
1070+
10131071- (void )setProgressHUDIndicatorStyle : (WSProgressHUDIndicatorStyle)style {
10141072 objc_setAssociatedObject (self, @selector (indicatorStyle ), @(style), OBJC_ASSOCIATION_ASSIGN );
10151073}
0 commit comments