Skip to content

Buggy animation #7

@gerchicov-bp

Description

@gerchicov-bp
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions