NSTimer where code repeats every (some time value in seconds) for 1 minute [duplicate]
I have read some docs on NSTimer and havent quite seen what I am looking for.
I would like to know how to write an NSTimer which will repeat every 1 sec or another time value(maybe have this value as parameter) and the overall repeat should repeat for one minute.
Also how is this overall time (1 minute) shown on screen , maybe in a UILabel?
Thanks
That's exactly what NSTimer does. You need to invalidate the timer yourself after a minute has passed though. Just keep count of the number of invocations and when you hit 60 you invalidate the timer.
NSTimer
NSTimer Programming Guide
精彩评论