美文网首页
AFN和MBProgressHUD组合使用

AFN和MBProgressHUD组合使用

作者: 王欣12138 | 来源:发表于2019-01-11 14:43 被阅读12次
+ (MBProgressHUD *)hud {
    MBProgressHUD *hud = objc_getAssociatedObject(self, _cmd);
    if (!hud) {
        hud = [[MBProgressHUD alloc] initWithView:kLastWindow];
        hud.label.text = @"正在加载";
        hud.contentColor = [UIColor whiteColor];
        hud.bezelView.color = [UIColor blackColor];
        objc_setAssociatedObject(self, _cmd, hud, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    return hud;
}

+ (MBProgressHUD *)shareHud {
    MBProgressHUD *hud = [self hud];
    [kLastWindow addSubview:hud];
    [hud showAnimated:YES];
    return hud;
}
//初始化方法
MBProgressHUD *hud = [self shareHud];
//隐藏方法
[hud hideAnimated:YES];

相关文章

网友评论

      本文标题:AFN和MBProgressHUD组合使用

      本文链接:https://www.haomeiwen.com/subject/kusxdqtx.html