Skip to content

Latest commit

 

History

History
81 lines (54 loc) · 2.13 KB

README.md

File metadata and controls

81 lines (54 loc) · 2.13 KB

DYFLoadingManager

DYFLoadingManager is an iOS management class that loads animation prompts, it displays a translucent mask with an indicator and labels while work is being done.

License MIT 

Chinese Instructions (中文说明)

Group (ID:614799921)

Preview

Usage

  • Show Loading
- (IBAction)show:(id)sender {
    [DYFLoadingManager.shared setDimBackground:NO];
    [DYFLoadingManager.shared setCentralImage:nil];

    [DYFLoadingManager.shared setText:@"全力加载中..."];

    [DYFLoadingManager.shared setRingColor:UIColor.whiteColor];
    [DYFLoadingManager.shared setCornerRadius:10.f];

    [DYFLoadingManager.shared showLoading];

    [self hideAfterDelay:5.f];
}
  • Show Loading in a view
- (IBAction)showInView:(id)sender {
    [DYFLoadingManager.shared setDimBackground:YES];
    
    UIImage *image = [UIImage imageNamed:@"tencentv_logo"];
    [DYFLoadingManager.shared setCentralImage:image];

    [DYFLoadingManager.shared setText:@"正在请求,请稍等..."];
    [DYFLoadingManager.shared setRingColor:UIColor.orangeColor];
    [DYFLoadingManager.shared setCornerRadius:15.f];

    UIView *view = self.navigationController.view;
    [DYFLoadingManager.shared showLoadingInView:view];

    [self hideAfterDelay:5.f];
}
  • Hide Loading
- (void)hideAfterDelay:(NSTimeInterval)delay {
    [self performSelector:@selector(hide) withObject:nil afterDelay:delay];
}

- (void)hide {
    if (DYFLoadingManager.shared.hasLoading) {
        [DYFLoadingManager.shared hideLoading];
    }
}

Demo

To learn more, please check out Demo.

Feedback is welcome

If you notice any issue, got stuck to create an issue. I will be happy to help you.