LHProgressHUD 0.1.1

LHProgressHUD 0.1.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2016年6月

LeoMobileDeveloper 维护。



  • LeoMobileDeveloper

GIf

要求

  • iOS 8+
  • ARC

安装

LHProgressHUD 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

pod "LHProgressHUD"

基本用法

如果您之前使用过 MBProgressHUD,那么使用这些 API 将会很容易。

显示 HUD 并将其作为子视图添加,然后隐藏它

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

LHProgressHUD 有四个基本子状态

  • 动画
  • 成功
  • 失败
  • 信息

您可以使用这些函数在子状态之间切换

-(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");
    }];
});

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];

您可以通过运行示例项目来获取更多信息

中文

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

作者

Leo, [email protected]

许可证

LHProgressHUD 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。