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

Running in background before .start is called #34

Open
nc14 opened this issue Apr 21, 2018 · 1 comment
Open

Running in background before .start is called #34

nc14 opened this issue Apr 21, 2018 · 1 comment

Comments

@nc14
Copy link

nc14 commented Apr 21, 2018

I'm running the code below but the countdown is starting in the background before .start is called. i.e. I'm arriving at the page, the timer shows the correct time and isn't moving, but when I hit the IB action (startWorkoutPressed) to start the timer, it 'jumps' to however long has passed since I loaded the page.

Have I got this configured wrong or is this a bug?

override func viewDidLoad() {
        super.viewDidLoad()
        let finalTime = Double(timeForWorkout)
        timerLabel.setCountDownTime(minutes: (finalTime)*60)
       
    }
    
    @IBAction func startWorkoutPressed(_ sender: UIButton) {
        
        timerLabel.start()
        
    }
@nc14
Copy link
Author

nc14 commented Apr 21, 2018

I can fix this by adding timerLabel.pause() to viewDidLoad but this doesn't seem very elegant?

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