bckbck
bckbck

Reputation:

NSTimer countdown with label to show time left

I need help for my app. I dont know how to use a NSTimer in my app, and also don't know how to make the value of time left display on a label. Also, is it possible to get a list of processes and use radio buttons to select whether to hide or kill a process after the timer is up?

Upvotes: 3

Views: 9888

Answers (2)

sudo rm -rf
sudo rm -rf

Reputation: 29524

First of all, this might be a good read: Using Timers

Finally, this answer should do exactly what you're asking for. With a little more searching you would have found this question.

Upvotes: 2

Nektarios
Nektarios

Reputation: 10351

An NSTimer is going to call your method at a regular interval - you can set this up to a 1 second period and decrement each tick. Or, to be more reliable, you can have it run more frequently and handle actual POSIX gettimeofday() to track time yourself and figure out the time remaining

And yes those things are possible. For radio buttons you would simply get their state and act upon that however you like. You can set them up to tell you when they change, or when you do your specified behavior you can check their status.

Upvotes: 0

Related Questions