7.10 和请求数据结合起来的菊花

2017-07-10  本文已影响0人  小码农杰哥

要跟百度网盘的#import "CustomNetWork.h"结合起来使用

在pods中的MBProgressHUD中添加方法:

.h中加:

/**

信息提示

*/

+ (void)showHUDMessageTitle:(NSString *)title;

/**

*  隐藏 HUD

*/

+ (void)dissmiss;

/**

*  显示 HUD

*

*  @return 返回一个 MBProgressHud 对象

*/

+ (instancetype)showHUD;

/**

在.m中添加:

//提示信息

+ (void)showHUDMessageTitle:(NSString *)title

{

MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:nil animated:YES];

hud.mode = MBProgressHUDModeText;

hud.labelText = title;

hud.margin = 10.f;

hud.yOffset = 0;

hud.removeFromSuperViewOnHide = YES;

[hud hide:YES afterDelay:2];

}

/**

*  隐藏 HUD

*/

+ (void)dissmiss

{

[self hideHUDForView:nil animated:YES];

}

/**

*  显示 HUD

*

*  @return 返回一个 MBProgressHud 对象

*/

+ (instancetype)showHUD

{

return [self showHUDAddedTo:nil animated:YES];

}

+ (instancetype)showHUDAddedTo:(UIView *)view animated:(BOOL)animated {

if (view==nil) {

view = (UIView*)[[[UIApplication sharedApplication]delegate]window];

}

MBProgressHUD *hud = [[self alloc] initWithView:view];

hud.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.3];

[view addSubview:hud];

[hud showAnimated:animated];

return hud;

}

+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated {

if (view==nil) {

view = (UIView*)[[[UIApplication sharedApplication]delegate]window];

}

MBProgressHUD *hud = [self HUDForView:view];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

NSArray *arr = [MBProgressHUD allHUDsForView:view];

UIView *view = [arr firstObject];

[view removeFromSuperview];

});

if (hud != nil) {

hud.removeFromSuperViewOnHide = YES;

[hud hide:animated];

return YES;

}

return NO;

}

上一篇 下一篇

猜你喜欢

热点阅读