LHProgressHUD 0.1.1

LHProgressHUD 0.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2016

Maintained by LeoMobileDeveloper.



  • By
  • LeoMobileDeveloper

GIf

Requirements

  • iOS 8+
  • ARC

Installation

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

pod "LHProgressHUD"

Basic Usage

If you have used MBProgressHUD before,it will be easy to use these API.

Show HUD and add it as a subview,then hide it

    LHProgressHUD * hud = [LHProgressHUD showSuccessAddedToView:self.view animated:YES];
    hud.textLabel.text = @"Loading...";
    [hud hideAfterDelay:1.0 hiddenBlock:^{
        NSLog(@"HUD is hidden");
    }];

LHProgressHUD have four basic sub state

  • Animating
  • Success
  • Failure
  • Info

You can use these function to switch between sub state

-(void)resetWithStatus:(NSString *)status;

-(void)showInfoWithStatus:(NSString *)status animated:(BOOL)animated;

-(void)showSuccessWithStatus:(NSString *)status animated:(BOOL)animated;

-(void)showFailureWithStatus:(NSString *)status animated:(BOOL)animated;

Pure Text

LHProgressHUD * hud = [LHProgressHUD showAddedToView:self.view];
hud.mode = LHProgressHUDModeTextOnly;
hud.textLabel.text = @"Loading...";
[hud hideAfterDelay:1.0];

Activity Indicator

LHProgressHUD * hud = [LHProgressHUD showAddedToView:self.view];
hud.mode = LHProgressHUDModeActivityIdenticator;
[hud hideAfterDelay:1.0];

Full Screen blur

LHProgressHUD * hud = [LHProgressHUD showAddedToView:self.view];
hud.textLabel.text = @"Loading...";
hud.spinnerColor = [UIColor whiteColor];
hud.infoColor = [UIColor orangeColor];
hud.backgroundView.blurStyle = LHBlurEffectStyleDark;
hud.centerBackgroundView.blurStyle = LHBlurEffectStyleNone;
hud.centerBackgroundView.backgroundColor = [UIColor clearColor];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    [hud showSuccessWithStatus:@"Success" animated:YES];
    [hud hideAfterDelay:1.0 hiddenBlock:^{
        NSLog(@"HUD is hidden");
    }];
});

GIf

LHProgressHUD * hud = [LHProgressHUD showAddedToView:self.view];
hud.mode = LHPRogressHUDModeGif;
hud.centerBackgroundView.blurStyle = LHBlurEffectStyleNone;
hud.centerBackgroundView.backgroundColor = [UIColor clearColor];
hud.gifImageView = [[LHGifImageView alloc] initWithGifImageName:@"gif"];
[hud hideAfterDelay:3.0];

You can get more deail by running the Example project

中文

如果你懂中文,可以在我的博客上看到中文文档

Author

Leo, [email protected]

License

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