This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is my stopwatch not working  RSS feed

 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to create a stopwatch that has a start button, a stop button and a pause button.
I have so far reached start and stop buttons but the are not working. What is the issue.
I have to even go ahead and create a pause button , how to do that. Please help.


 
Rancher
Posts: 3455
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "not working" mean?

What happens when you click the start button?
 
Dave Tolls
Rancher
Posts: 3455
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing does leap out at me.
Why is there a loop in the start() method?

That method is going to be called each second, so I don't see what the loop is for, or the call to myTimer().

In addition, the call to setInterval gives you an id for the timer it has created.  That's the timer that needs to be cleared, not a new one.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!