JonasGessner / JGProgressHUD

An elegant and simple progress HUD for iOS and tvOS, compatible with Swift and ObjC.
MIT License
3.35k stars 336 forks source link

Fade in animation not smooth on iOS 10 #67

Closed dougamos closed 7 years ago

dougamos commented 8 years ago

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

JonasGessner commented 8 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.

kkubkko commented 7 years ago

Any progress? :)

kkubkko commented 7 years ago

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 :)

JonasGessner commented 7 years ago

Sweet. Feel free to open a pull request and I'll check it out!

JonasGessner commented 7 years ago

This seems to be fixed on iOS 11. Can anybody confirm this?