Closed dougamos closed 7 years ago
It seems like the blur view doesn't play along nicely with the alpha animation. I'll see if I can find a fix for this.
Any progress? :)
I've handled it by my own like this : (According to this post : http://stackoverflow.com/questions/29307827/how-does-one-fade-a-uivisualeffectview-and-or-uiblureffect-in-and-out)
private let overlay = UIVisualEffectView()
In some init() method:
hudView.addSubview(overlay)
hudView.sendSubview(toBack: overlay)
overlay.layer.masksToBounds = true
override func show(in view: UIView!)
{
self.alpha = 1
indicatorView.alpha = 0
super.show(in: view, animated: false)
overlay.frame = self.hudView.bounds
overlay.center = self.indicatorView.center
UIView.animate(withDuration: 0.5, animations:
{
self.indicatorView.alpha = 1
self.overlay.effect = UIBlurEffect(style: .dark)
})
}
Works like a charm :)
Sweet. Feel free to open a pull request and I'll check it out!
This seems to be fixed on iOS 11. Can anybody confirm this?
On iOS 9 the HUD fades in smoothly from what appears to be alpha 0.0 -> 1.0. On iOS 10 the animation seems to fade from alpha 0.0 -> 0.5 and then within one frame jumps to 1.0. See attached movie screen captures to see in action.
I am using JGProgressHUD version 1.4. The code to bring up the dark HUD is straightforward with no custom subclassing etc.
screen_movies.zip