Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buggy animation #7

Open
gerchicov-bp opened this issue Oct 4, 2018 · 0 comments
Open

Buggy animation #7

gerchicov-bp opened this issue Oct 4, 2018 · 0 comments

Comments

@gerchicov-bp
Copy link

    func loadDeterminate() {
        self.progressButton.stopIndeterminate()
        self.progressButton.resetProgress()
        let timer = Timer.scheduledTimer(timeInterval: 1,
                                         target: self,
                                         selector: #selector(self.animateDeterminate),
                                         userInfo: time,
                                         repeats: true)
        RunLoop.current.add(timer, forMode: .defaultRunLoopMode)
    }
    
    @objc func animateDeterminate(sender: Timer) {
        if self.progressButton.progress >= 1.0 {
            sender.invalidate()
        }
        else {
            self.progressButton.setProgress(progress: self.progressButton.progress + CGFloat(0.1), false)
        }
    }

I need to update the button rarely. So I replaced some numbers in your example, ran it on iphone 5s simulator, choose "determinate" and clicked this buttom:
1)timer's step is 0.1, its value is changed from 0 to 1. So why does it show 8 steps instead of 10?
2)if you do some clicks on button (or other clickable elements) - animation is changed unpredictably

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant