为什么 UIProgressView 设置进度不停止?

Why UIProgressView set progress not stopping?

我想在移动到 App 或 Auth 之前显示进度条动画VC

通过下面的代码,它工作正常,但问题只出现了一次(启动应用程序时)

所以,问题是停止问题吗?如果是怎么处理请问??

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(true)


        Auth.auth().addStateDidChangeListener { (auth, user) in
        if user == nil {
            // User Signed out

            self.progressive.setProgress(3, animated: true)
            // Before calling asyncAfter perform showing loader or anything you want.


            DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
                // Your code to execute after a delay of 3 seconds.
                self.performSegue(withIdentifier: "Auth", sender: nil)
            }

        } else {
            // User Signed In

            self.progressive.setProgress(3, animated: true)
            // Before calling asyncAfter perform showing loader or anything you want.

            self.progressive.setProgress(3, animated: true)

            DispatchQueue.main.asyncAfter(deadline: .now() + 3) {

                self.performSegue(withIdentifier: "App", sender: nil)
            }
        }
    }
}

不要忘记在某处重置 progressView:

self.progressive.setProgress(0, animated: false)

解决方法是将进度值重置为0

我在 viewDidAppear 函数中试过了,它成功了!

overide viewDidAppear func (_ animated: Bool) {
    super.viewDidAppear(true)

    self.progressive.progress = 0   

   }