Skip to content

Commit e216bed

Browse files
committed
update -> Finished 1.0.9
1 parent c5e79a0 commit e216bed

File tree

8 files changed

+442
-113
lines changed

8 files changed

+442
-113
lines changed

Demo/WSProgressHUD/WSProgressHUD.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
6868
/*----------------------------Custom---------------------------------*/
6969

7070
+ (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style;
71+
72+
/// if you set WSProgressHUDIndicatorBigGray style you should set second prority indicator Style
73+
+ (void)setSecondProrityIndicatorStyle: (WSProgressHUDIndicatorStyle)style; //Default is small SmallLight
74+
7175
+ (void)setProgressHUDFont: (UIFont *)font;
7276
+ (void)setIndicatorColor: (UIColor *)color;
7377

@@ -104,6 +108,10 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
104108

105109
/*----------------------------Custom---------------------------------*/
106110
- (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style;
111+
112+
/// if you set WSProgressHUDIndicatorBigGray style you should set second prority indicator Style
113+
- (void)setSecondProrityIndicatorStyle: (WSProgressHUDIndicatorStyle)style; //Default is small SmallLight
114+
107115
- (void)setProgressHUDFont: (UIFont *)font;
108116
- (void)setIndicatorColor: (UIColor *)color;
109117

Demo/WSProgressHUD/WSProgressHUD.m

Lines changed: 89 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
{

Demo/WSProgressHUDDemo/ViewController.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,16 @@ - (void)didReceiveMemoryWarning {
4444
}
4545
- (IBAction)show:(id)sender {
4646

47-
[WSProgressHUD setProgressHUDIndicatorStyle:WSProgressHUDIndicatorGray];
47+
// [WSProgressHUD setProgressHUDIndicatorStyle:WSProgressHUDIndicatorGray];
48+
[WSProgressHUD setProgressHUDIndicatorStyle:WSProgressHUDIndicatorBigGray];
4849
[WSProgressHUD show];
4950

5051
[self autoDismiss];
5152
}
5253

5354
- (IBAction)showShimmeringString:(id)sender {
54-
// [hud show];
55-
[WSProgressHUD setProgressHUDIndicatorStyle:WSProgressHUDIndicatorBigGray];
5655

57-
// [WSProgressHUD showShimmeringString:@"WSProgressHUD Loading..." maskType:WSProgressHUDMaskTypeBlack maskWithout:WSProgressHUDMaskWithoutNavigation];
58-
[WSProgressHUD show];
56+
[WSProgressHUD showShimmeringString:@"WSProgressHUD Loading..." maskType:WSProgressHUDMaskTypeBlack maskWithout:WSProgressHUDMaskWithoutNavigation];
5957

6058
[self autoDismiss];
6159
}

Demo/logo.jpg

67.5 KB
Loading

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# WSProgressHUD
22
This is a beauful hud view for iPhone & iPad
33

4+
[![logo](https://raw.githubusercontent.com/devSC/WSProgressHUD/master/Demo/logo.jpg)
5+
6+
47
[![CI Status](http://img.shields.io/travis/袁仕崇/WSProgressHUD.svg?style=flat)](https://travis-ci.org/袁仕崇/WSProgressHUD)
58
[![Version](https://img.shields.io/cocoapods/v/WSProgressHUD.svg?style=flat)](http://cocoapods.org/pods/WSProgressHUD)
69
[![License](https://img.shields.io/cocoapods/l/WSProgressHUD.svg?style=flat)](http://cocoapods.org/pods/WSProgressHUD)

WSProgressHUD.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "WSProgressHUD"
19-
s.version = "1.0.8"
19+
s.version = "1.0.9"
2020
s.summary = "WSProgressHUD is a beauful hud view for iPhone & iPad."
2121

2222
s.description = <<-DESC
@@ -34,7 +34,7 @@ Pod::Spec.new do |s|
3434

3535
s.author = { "袁仕崇" => "[email protected]" }
3636
s.platform = :ios, "6.0"
37-
s.source = { :git => "https://github.com/devSC/WSProgressHUD.git", :tag => "1.0.8" }
37+
s.source = { :git => "https://github.com/devSC/WSProgressHUD.git", :tag => "1.0.9" }
3838
s.source_files = "WSProgressHUD/*"
3939
s.exclude_files = "Demo/Exclude"
4040

WSProgressHUD/WSProgressHUD.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
2626
WSProgressHUDIndicatorCustom,
2727
WSProgressHUDIndicatorMMSpinner,
2828
WSProgressHUDIndicatorSmallLight,
29+
WSProgressHUDIndicatorGray,
30+
WSProgressHUDIndicatorBigGray,
2931
};
3032

3133

@@ -54,19 +56,24 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
5456
+ (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProgressHUDMaskType)maskType;
5557
+ (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType;
5658

59+
//imageSize is 28*28
5760
+ (void)showImage:(UIImage *)image status:(NSString *)title;
5861
+ (void)showImage:(UIImage *)image status:(NSString *)title maskType: (WSProgressHUDMaskType)maskType;
5962
+ (void)showImage:(UIImage *)image status:(NSString *)title maskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType;
6063

6164
+ (void)showSuccessWithStatus: (NSString *)string;
6265
+ (void)showErrorWithStatus: (NSString *)string;
63-
6466
+ (void)dismiss;
6567

6668
/*----------------------------Custom---------------------------------*/
6769

6870
+ (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style;
6971

72+
/// if you set WSProgressHUDIndicatorBigGray style you should set second prority indicator Style
73+
+ (void)setSecondProrityIndicatorStyle: (WSProgressHUDIndicatorStyle)style; //Default is small SmallLight
74+
75+
+ (void)setProgressHUDFont: (UIFont *)font;
76+
+ (void)setIndicatorColor: (UIColor *)color;
7077

7178
/*----------------------Show On the view------------------------------*/
7279

@@ -97,7 +104,16 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
97104
- (void)showSuccessWithString: (NSString *)string;
98105
- (void)showErrorWithString: (NSString *)string;
99106

100-
101107
- (void)dismiss;
102108

109+
/*----------------------------Custom---------------------------------*/
110+
- (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style;
111+
112+
/// if you set WSProgressHUDIndicatorBigGray style you should set second prority indicator Style
113+
- (void)setSecondProrityIndicatorStyle: (WSProgressHUDIndicatorStyle)style; //Default is small SmallLight
114+
115+
- (void)setProgressHUDFont: (UIFont *)font;
116+
- (void)setIndicatorColor: (UIColor *)color;
117+
118+
103119
@end

0 commit comments

Comments
 (0)