@@ -565,9 +565,11 @@ - (void)updatePositionWithString: (NSString *)string hudBounds: (CGRect)bounds
565565 if (string) {
566566
567567 if (self.indicatorStyle == WSProgressHUDIndicatorGray ||
568- self.indicatorStyle == WSProgressHUDIndicatorBigGray) {
569-
570- self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
568+ self.indicatorStyle == WSProgressHUDIndicatorBigGray ||
569+ [self secondProrityIndicatorStyle ] == WSProgressHUDIndicatorGray) { // 如果第二优先级的是gray
570+ // if ([self secondProrityIndicatorStyle] == WSProgressHUDIndicatorGray) {
571+ // }
572+ self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; // 设置为白色
571573 }
572574
573575 self.labelView .frame = WSProgressHUDStringRect;
@@ -578,7 +580,9 @@ - (void)updatePositionWithString: (NSString *)string hudBounds: (CGRect)bounds
578580
579581 if (self.indicatorStyle == WSProgressHUDIndicatorGray ||
580582 self.indicatorStyle == WSProgressHUDIndicatorBigGray ) {
583+
581584 self.hudView .backgroundColor = [UIColor clearColor ];
585+
582586 if (self.maskType == WSProgressHUDMaskTypeBlack || self.maskType == WSProgressHUDMaskTypeGradient) {
583587 self.indicatorView .color = [UIColor whiteColor ];
584588 } else {
@@ -771,12 +775,11 @@ - (void)updateSubview
771775 switch (self.hudType ) {
772776 case WSProgressHUDTypeStatus: {
773777
774- [self startIndicatorAnimation: YES ];
775778
776779 if (self.labelView .text ) {
777-
778780 if (self.indicatorStyle == WSProgressHUDIndicatorGray ||
779- self.indicatorStyle == WSProgressHUDIndicatorBigGray) {
781+ self.indicatorStyle == WSProgressHUDIndicatorBigGray ||
782+ [self secondProrityIndicatorStyle ] == WSProgressHUDIndicatorGray) {
780783
781784 self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
782785 }
@@ -798,6 +801,8 @@ - (void)updateSubview
798801 self.spinnerView .center = self.indefiniteAnimationView .center = self.indicatorView .center = CGPointMake (hudCenterX, hudCenterY);
799802 }
800803
804+ [self startIndicatorAnimation: YES ];
805+
801806 }break ;
802807
803808 case WSProgressHUDTypeString: {
@@ -907,8 +912,65 @@ - (void)startIndicatorAnimation: (BOOL)start
907912 }break ;
908913 case WSProgressHUDIndicatorBigGray: {
909914
910- self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
911- self.indicatorView .color = [UIColor lightGrayColor ];
915+ if (self.labelView .text ) {
916+ [self startSecondProrityIndicatorAnimation: start];
917+ } else {
918+ self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
919+ // self.indicatorView.color = [UIColor lightGrayColor];
920+ self.indefiniteAnimationView .hidden = YES ;
921+ self.spinnerView .hidden = YES ;
922+ if (start) {
923+ [self .indicatorView startAnimating ];
924+ } else {
925+ [self .indicatorView stopAnimating ];
926+ }
927+ }
928+ }break ;
929+
930+ default :
931+ break ;
932+ }
933+ }
934+
935+ - (void )startSecondProrityIndicatorAnimation : (BOOL )start
936+ {
937+ switch ([self secondProrityIndicatorStyle ]) {
938+
939+ case WSProgressHUDIndicatorSmallLight: {
940+ self.indefiniteAnimationView .hidden = YES ;
941+ self.spinnerView .hidden = YES ;
942+ if (start) {
943+ [self .indicatorView startAnimating ];
944+ } else {
945+ [self .indicatorView stopAnimating ];
946+ }
947+ }break ;
948+
949+ case WSProgressHUDIndicatorBigGray:
950+ case WSProgressHUDIndicatorCustom: {
951+ [self .indicatorView stopAnimating ];
952+ self.spinnerView .hidden = YES ;
953+ self.indicatorView .hidden = YES ;
954+ if (start) {
955+ self.indefiniteAnimationView .hidden = NO ;
956+ } else {
957+ self.indefiniteAnimationView .hidden = YES ;
958+ }
959+ }break ;
960+ case WSProgressHUDIndicatorMMSpinner: {
961+ self.indicatorView .hidden = YES ;
962+ self.indefiniteAnimationView .hidden = YES ;
963+ if (start) {
964+ self.spinnerView .hidden = NO ;
965+ [self .spinnerView startAnimating ];
966+ } else {
967+ self.spinnerView .hidden = YES ;
968+ }
969+ }break ;
970+ case WSProgressHUDIndicatorGray: {
971+
972+ self.indicatorView .activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
973+
912974 self.indefiniteAnimationView .hidden = YES ;
913975 self.spinnerView .hidden = YES ;
914976 if (start) {
@@ -917,12 +979,12 @@ - (void)startIndicatorAnimation: (BOOL)start
917979 [self .indicatorView stopAnimating ];
918980 }
919981 }break ;
920-
921982 default :
922983 break ;
923984 }
924985}
925986
987+
926988- (void )setShimmeringLabelSize : (CGSize)size
927989{
928990 CGRect bounds = self.shimmeringLabel .bounds ;
@@ -1072,6 +1134,12 @@ + (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style {
10721134 [[self shareInstance ] setProgressHUDIndicatorStyle: style];
10731135}
10741136
1137+ // / if you set WSProgressHUDIndicatorBigGray style you should set second prority indicator Style ->no use
1138+ + (void )setSecondProrityIndicatorStyle : (WSProgressHUDIndicatorStyle)style
1139+ {
1140+ [[self shareInstance ] setSecondProrityIndicatorStyle: style];
1141+ }
1142+
10751143+ (void )setProgressHUDFont : (UIFont *)font
10761144{
10771145 [[self shareInstance ] setProgressHUDFont: font];
@@ -1088,6 +1156,12 @@ - (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style {
10881156 objc_setAssociatedObject (self, @selector (indicatorStyle ), @(style), OBJC_ASSOCIATION_ASSIGN );
10891157}
10901158
1159+ // / if you set WSProgressHUDIndicatorBigGray style you should set second prority indicator Style ->no use
1160+ - (void )setSecondProrityIndicatorStyle : (WSProgressHUDIndicatorStyle)style
1161+ {
1162+ objc_setAssociatedObject (self, @selector (secondProrityIndicatorStyle ), @(style), OBJC_ASSOCIATION_ASSIGN );
1163+ }
1164+
10911165#pragma mark - Draw rect
10921166- (void )drawRect : (CGRect)rect
10931167{
@@ -1346,14 +1420,19 @@ - (BOOL)hudIsShowing
13461420{
13471421 return [objc_getAssociatedObject (self , _cmd ) boolValue ];
13481422}
1349- - (WSProgressHUDIndicatorStyle )indicatorStyle {
1423+ - (WSProgressHUDIndicatorStyle)indicatorStyle {
13501424 return [objc_getAssociatedObject (self , _cmd ) integerValue ];
13511425}
13521426- (BOOL )showOnTheWindow
13531427{
13541428 return [objc_getAssociatedObject (self , _cmd ) boolValue ];
13551429}
13561430
1431+ - (WSProgressHUDIndicatorStyle)secondProrityIndicatorStyle
1432+ {
1433+ return [objc_getAssociatedObject (self , _cmd ) integerValue ];
1434+ }
1435+
13571436
13581437- (void )dealloc
13591438{
0 commit comments