/LWHUD

MBProgressHUD 的Fork的重命名版.适用于在SDK中使用,可为避免SDK与App的依赖冲突.

Primary LanguageObjective-CMIT LicenseMIT

LWHUD

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

+(void)showHUDWithMessage:(NSString *)message{
    if(!message || message.length == 0){
        return;
    }
    LWHUD *hud = [LWHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.label.text = message;
    hud.mode = LWHUDModeText;
    hud.removeFromSuperViewOnHide = YES;
    [hud hideAnimated:YES afterDelay:2];
}
+(void)showHUDWithDetailMessage:(NSString *)message {
    if(!message || message.length == 0){
        return;
    }
    LWHUD *hud = [LWHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.detailsLabel.text = message;
    hud.mode = LWHUDModeText;
    hud.removeFromSuperViewOnHide = YES;
    [hud hideAnimated:YES afterDelay:2];
}

+(LWHUD *)showHUDWithMessage:(NSString *)message mode:(LWHUDMode)mode {
    LWHUD *hud = [LWHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.label.text = message;
    hud.mode = mode;
    hud.removeFromSuperViewOnHide = YES;
    return hud;
}

+ (void)showHUDLoading {
    LWHUD *hud = [LWHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    hud.mode = LWHUDModeIndeterminate;
    hud.removeFromSuperViewOnHide = YES;
    [hud showAnimated:YES];
}

+(void)hideHUDLoading {
    UIWindow *keywindow = [UIApplication sharedApplication].keyWindow;
    for(UIView *view in keywindow.subviews){
        if([view isKindOfClass:[LWHUD class]]){
            [(LWHUD *)view hideAnimated:NO];
            [view removeFromSuperview];
        }
    }
}

Requirements

Installation

LWHUD is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'LWHUD'

Carthage

github "luowei/LWHUD"

Author

luowei, luowei@wodedata.com

License

LWHUD is available under the MIT license. See the LICENSE file for more info.