Skip to content

Commit c5e79a0

Browse files
committed
Update->Fix hud view orientation bugs.
1 parent a22f5d0 commit c5e79a0

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Demo/WSProgressHUD.xcodeproj/project.xcworkspace/xcuserdata/devSC.xcuserdatad
2+
Demo/WSProgressHUD.xcodeproj/project.xcworkspace
3+
Demo/WSProgressHUD.xcodeproj/project.xcworkspace/xcuserdata
4+
Demo/WSProgressHUD.xcodeproj
5+
Demo/WSProgressHUD.xcodeproj/xcuserdata/devSC.xcuserdatad/xcschemes
6+
Demo/WSProgressHUD.xcodeproj/xcuserdata
7+
Demo/WSProgressHUD.xcodeproj/xcuserdata/devSC.xcuserdatad/xcdebugger
8+
Demo/WSProgressHUD.xcodeproj/xcuserdata/devSC.xcuserdatad
9+
Demo/WSProgressHUD.xcodeproj/project.xcworkspace/xcuserdata/devSC.xcuserdatad/UserInterfaceState.xcuserstate
10+
Demo/WSProgressHUD.xcodeproj/xcuserdata/devSC.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
11+
Demo/WSProgressHUD.xcodeproj/xcuserdata/devSC.xcuserdatad/xcschemes/WSProgressHUD.xcscheme
12+
Demo/WSProgressHUD.xcodeproj/xcuserdata/devSC.xcuserdatad/xcschemes/xcschememanagement.plist

Demo/WSProgressHUD/WSProgressHUD.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
2727
WSProgressHUDIndicatorMMSpinner,
2828
WSProgressHUDIndicatorSmallLight,
2929
WSProgressHUDIndicatorGray,
30-
WSProgressHUDIndicatorBigGray,//Avaliable ios 7.0+
30+
WSProgressHUDIndicatorBigGray,
3131
};
3232

3333

@@ -63,13 +63,13 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
6363

6464
+ (void)showSuccessWithStatus: (NSString *)string;
6565
+ (void)showErrorWithStatus: (NSString *)string;
66-
6766
+ (void)dismiss;
6867

6968
/*----------------------------Custom---------------------------------*/
7069

7170
+ (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style;
7271
+ (void)setProgressHUDFont: (UIFont *)font;
72+
+ (void)setIndicatorColor: (UIColor *)color;
7373

7474
/*----------------------Show On the view------------------------------*/
7575

@@ -105,6 +105,7 @@ typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
105105
/*----------------------------Custom---------------------------------*/
106106
- (void)setProgressHUDIndicatorStyle: (WSProgressHUDIndicatorStyle)style;
107107
- (void)setProgressHUDFont: (UIFont *)font;
108+
- (void)setIndicatorColor: (UIColor *)color;
108109

109110

110111
@end

Demo/WSProgressHUD/WSProgressHUD.m

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,8 @@ - (void)updateShimmingViewIfNeed
763763
- (void)updateSubview
764764
{
765765
self.hudView.bounds = WSProgressHUDNewBounds;
766-
766+
self.hudView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
767+
767768
CGFloat hudCenterX = CGRectGetWidth(self.hudView.bounds)/2;
768769
CGFloat hudCenterY = CGRectGetHeight(self.hudView.bounds)/2;
769770

@@ -773,12 +774,27 @@ - (void)updateSubview
773774
[self startIndicatorAnimation:YES];
774775

775776
if (self.labelView.text) {
776-
self.labelView.frame = WSProgressHUDStringRect;
777777

778+
if (self.indicatorStyle == WSProgressHUDIndicatorGray ||
779+
self.indicatorStyle == WSProgressHUDIndicatorBigGray) {
780+
781+
self.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
782+
}
783+
784+
self.labelView.frame = WSProgressHUDStringRect;
778785
self.spinnerView.center = self.indefiniteAnimationView.center = self.indicatorView.center = CGPointMake(15, hudCenterY);
779786
self.labelView.center = CGPointMake(hudCenterX + 10, hudCenterY);
780787

781788
} else {
789+
if (self.indicatorStyle == WSProgressHUDIndicatorGray ||
790+
self.indicatorStyle == WSProgressHUDIndicatorBigGray ) {
791+
self.hudView.backgroundColor = [UIColor clearColor];
792+
if (self.maskType == WSProgressHUDMaskTypeBlack || self.maskType == WSProgressHUDMaskTypeGradient) {
793+
self.indicatorView.color = [UIColor whiteColor];
794+
} else {
795+
self.indicatorView.color = [UIColor grayColor];
796+
}
797+
}
782798
self.spinnerView.center = self.indefiniteAnimationView.center = self.indicatorView.center = CGPointMake(hudCenterX, hudCenterY);
783799
}
784800

Demo/WSProgressHUDDemo/ViewController.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ - (void)viewDidLoad {
3636
[hud dismiss];
3737
});
3838

39-
[self registerOrientationDidChangeObserve];
4039
}
4140

4241
- (void)didReceiveMemoryWarning {
@@ -108,16 +107,6 @@ - (void)autoDismiss
108107
});
109108

110109
}
111-
- (void)registerOrientationDidChangeObserve
112-
{
113-
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarOrientationDidChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
114-
115-
}
116-
117-
- (void)statusBarOrientationDidChange: (NSNotification *)notification {
118-
NSLog(@"%@", NSStringFromCGRect(self.navigationController.navigationBar.frame));
119-
}
120-
121110

122111

123112
@end

0 commit comments

Comments
 (0)