From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Util/Category/UIViewController+HUD.m | 71 +++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Util/Category/UIViewController+HUD.m b/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Util/Category/UIViewController+HUD.m new file mode 100755 index 0000000..4919ca8 --- /dev/null +++ b/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Util/Category/UIViewController+HUD.m @@ -0,0 +1,71 @@ +/************************************************************ + * * Hyphenate CONFIDENTIAL + * __________________ + * Copyright (C) 2016 Hyphenate Inc. All rights reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Hyphenate Inc. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Hyphenate Inc. + */ + +#import "UIViewController+HUD.h" + +#import "MBProgressHUD.h" +#import <objc/runtime.h> + +static const void *HttpRequestHUDKey = &HttpRequestHUDKey; + +@implementation UIViewController (HUD) + +- (MBProgressHUD *)HUD{ + return objc_getAssociatedObject(self, HttpRequestHUDKey); +} + +- (void)setHUD:(MBProgressHUD *)HUD{ + objc_setAssociatedObject(self, HttpRequestHUDKey, HUD, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (void)showHudInView:(UIView *)view hint:(NSString *)hint{ + MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:view]; + HUD.labelText = hint; + [view addSubview:HUD]; + [HUD show:YES]; + [self setHUD:HUD]; +} + +- (void)showHint:(NSString *)hint +{ + UIView *view = [[UIApplication sharedApplication].delegate window]; + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; + hud.userInteractionEnabled = NO; + // Configure for text only and offset down + hud.mode = MBProgressHUDModeText; + hud.labelText = hint; + hud.margin = 10.f; + hud.yOffset = 180; + hud.removeFromSuperViewOnHide = YES; + [hud hide:YES afterDelay:2]; +} + +- (void)showHint:(NSString *)hint yOffset:(float)yOffset +{ + UIView *view = [[UIApplication sharedApplication].delegate window]; + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; + hud.userInteractionEnabled = NO; + // Configure for text only and offset down + hud.mode = MBProgressHUDModeText; + hud.labelText = hint; + hud.margin = 10.f; + hud.yOffset = 180; + hud.yOffset += yOffset; + hud.removeFromSuperViewOnHide = YES; + [hud hide:YES afterDelay:2]; +} + +- (void)hideHud{ + [[self HUD] hide:YES]; +} + +@end -- Gitblit v1.8.0