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.
- 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];
}
}
To learn more, please check out Demo.
If you notice any issue, got stuck to create an issue. I will be happy to help you.