Closed brightsider closed 5 years ago
I got it working by setting blurEffectStyle through MBProgressHUD.appearance()
And how you change blurEffectStyle through appearance? I don't see this functionality in code.
hud.label.superview?.subviews.forEach({ (view) in if view is UIVisualEffectView { let blur = UIBlurEffect(style: UIBlurEffectStyle.dark) (view as! UIVisualEffectView).effect = blur } })
(this is my way to solve this bug).
+1
+1
Fixed by https://github.com/jdg/MBProgressHUD/pull/525 and added a regression test.
extension MBBackgroundView {
private func getEffectView() -> UIVisualEffectView? {
for view in subviews {
if let effectView = view as? UIVisualEffectView {
return effectView
}
}
return nil
}
func updateBlurEffect(style: UIBlurEffect.Style) {
getEffectView()?.removeFromSuperview()
blurEffectStyle = style
if let blurView = getEffectView() {
sendSubviewToBack(blurView)
}
}
}
I'm add MBProgressHUD and after changing blurEffectStyle layouts stacked in incorrect order
MBProgressHUD *currentProgress = [[MBProgressHUD alloc] initWithView:view]; currentProgress.bezelView.blurEffectStyle = UIBlurEffectStyleDark; currentProgress.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2]; currentProgress.removeFromSuperViewOnHide = YES; [view addSubview:currentProgress]; [currentProgress showAnimated:YES];