Commit 81beb6dc authored by 曹云霄's avatar 曹云霄

修改项说明:优化网络请求、提示框

parent 6218ab28
...@@ -88,13 +88,12 @@ ...@@ -88,13 +88,12 @@
{ {
[[AFNetworkReachabilityManager sharedManager] startMonitoring]; [[AFNetworkReachabilityManager sharedManager] startMonitoring];
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) { switch (status) {
case AFNetworkReachabilityStatusUnknown: case AFNetworkReachabilityStatusUnknown:
case AFNetworkReachabilityStatusNotReachable:{ case AFNetworkReachabilityStatusNotReachable:{
NSLog(@"无网络"); NSLog(@"无网络");
[XBLoadingView showHUDViewWithText:NETWORK];
break; break;
} }
case AFNetworkReachabilityStatusReachableViaWiFi:{ case AFNetworkReachabilityStatusReachableViaWiFi:{
......
...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
*/ */
+ (void)showHUDViewWithText:(NSString *)text; + (void)showHUDViewWithText:(NSString *)text;
/**
显示成功提示框
@param text 提示信息
*/
+ (void)showHUDViewWithSuccessText:(NSString *)text;
/** /**
显示进度框 显示进度框
...@@ -31,7 +37,7 @@ ...@@ -31,7 +37,7 @@
@return XBLoadingView @return XBLoadingView
*/ */
+ (instancetype)showHUDViewProgressLabel:(NSString *)text; + (MBProgressHUD *)showHUDViewProgressLabel:(NSString *)text;
/** /**
隐藏加载框 隐藏加载框
......
...@@ -10,12 +10,76 @@ ...@@ -10,12 +10,76 @@
@implementation XBLoadingView @implementation XBLoadingView
/* /**
// Only override drawRect: if you perform custom drawing. 显示普通加载框
// An empty implementation adversely affects performance during animation. */
- (void)drawRect:(CGRect)rect { + (void)showHUDViewWithDefault
// Drawing code {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeIndeterminate;
hud.color = [UIColor clearColor];
hud.activityIndicatorColor = kMainBlueColor;
hud.removeFromSuperViewOnHide = YES;
}
/**
显示文本提示框
@param text 提示信息
*/
+ (void)showHUDViewWithText:(NSString *)text
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
hud.labelText = text;
hud.margin = 20.f;
hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:3.0f];
}
/**
显示成功提示框
@param text 提示信息
*/
+ (void)showHUDViewWithSuccessText:(NSString *)text
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
hud.mode = MBProgressHUDModeCustomView;
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
hud.customView = [[UIImageView alloc] initWithImage:image];
hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.6];
hud.labelFont = [UIFont systemFontOfSize:15];
hud.labelText = text;
[hud hide:YES afterDelay:3];
}
/**
显示进度框
@param text 提示信息
@return XBLoadingView
*/
+ (MBProgressHUD *)showHUDViewProgressLabel:(NSString *)text
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
hud.mode = MBProgressHUDModeDeterminate;
hud.labelText = text;
hud.labelFont = [UIFont systemFontOfSize:12];
hud.removeFromSuperViewOnHide = YES;
return hud;
}
/**
隐藏加载框
*/
+ (void)hideHUDViewWithDefault
{
[[self class] hideHUDForView:SHARED_APPDELEGATE.window animated:YES];
} }
*/
@end @end
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#import "XLPlainFlowLayout.h" #import "XLPlainFlowLayout.h"
#import "MDScratchImageView.h" #import "MDScratchImageView.h"
#import "WYPopoverController.h" #import "WYPopoverController.h"
#import "XBLoadingView.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment