mrackwitz / MRProgress

Collection of iOS drop-in components to visualize progress
MIT License
2.55k stars 306 forks source link

Overlay stops animating and view disappears when switching tabs #78

Open alexshive opened 9 years ago

alexshive commented 9 years ago

When swapping tabs, it stops the animation and looks broken. One workaround that helped me is by using the viewDidAppear/viewDidDisappear functions.

class ViewController: UIViewController {

    var overlay = MRProgressOverlayView()

    override func viewDidAppear(animated: Bool) {
         overlay = MRProgressOverlayView.showOverlayAddedTo(self.view, animated: false)
    }

    override func viewDidDisappear(animated: Bool) {
        overlay.dismiss(false)
    }
}
gabriel commented 9 years ago

I'm hitting this bug too...

traleluia commented 9 years ago

I am also with this problem

gpolak commented 9 years ago

+1

mrackwitz commented 9 years ago

So one obvious issue in the probably reduced example code here is that an overlay is initialized, but not added to the view hierachy before the view is loaded.

class ViewController: UIViewController {

-    var overlay = MRProgressOverlayView()
+    var overlay: MRProgressOverlayView?

Did you had the initialization before in an overriden viewDidLoad method?