Closed wulongwang closed 6 years ago
The graceTime needs to be set before the hud is shown. You thus can't use showHUDAddedTo:animated:
, but instead need to alloc / init the hud, configure the grace time and than call show manually.
I'll improve the documentation for this.
Could you provide an example code please. I do:
let hud = MBProgressHUD(view: view)
hud.graceTime = 2
hud.removeFromSuperViewOnHide = true
hud.animationType = .zoom
hud.backgroundView.style = .blur
hud.bezelView.color = UIColor.white
hud.bezelView.style = .blur
hud.show(animated: true)
but it doesn't work.
Addressed in d416673
@NikKovIos I know is a super old thread but just ran into the same problem.
add view.addSubview(hud)
to your code and it should work
[MBProgressHUD appearance].contentColor = [UIColor greenColor]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES]; hud.graceTime = 5.0f; hud.completionBlock = ^{ NSLog(@"------------completionBlock"); }; when you create MBProgressHUD instance and show ,the graceTime always zero,because you set graceTime hud already show and don't change the graceTime value