TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2016 |
Maintained by LeoMobileDeveloper.
LHProgressHUD is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "LHProgressHUD"
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
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;
LHProgressHUD * hud = [LHProgressHUD showAddedToView:self.view];
hud.mode = LHProgressHUDModeTextOnly;
hud.textLabel.text = @"Loading...";
[hud hideAfterDelay:1.0];
LHProgressHUD * hud = [LHProgressHUD showAddedToView:self.view];
hud.mode = LHProgressHUDModeActivityIdenticator;
[hud hideAfterDelay:1.0];
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");
}];
});
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
如果你懂中文,可以在我的博客上看到中文文档
Leo, [email protected]
LHProgressHUD is available under the MIT license. See the LICENSE file for more info.