I need help for my app. I dont k开发者_开发技巧now 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?
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.
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.
精彩评论