iPhone Objective-C Programming NSTimer

In the course of your iPhone Objective-C programming you will likely have the need for an NSTimer at some point so it’s good to have an understanding of how they work.

I found this good example here on timers: NSTimer the Poor Man’s Threading Code Snapshot

While it’s foolishly titled a Poor Man’s Threading which may give you the impression that timer and thread are synonymous it shows a nice flashy example of NSTimer’s in action.  If you’re looking for the Cocoa threading class you will want to look up NSThread which I will be featuring in an upcoming tutorial.

Something to take note of with timers is that they can be highly inaccurate so if you end up having multiple timers firing in sequence you may want to check the time index and adjust the length of your timer approperiately to produce more consistent results.

Check it out, and if you’re having trouble with timer’s you might want to play around with it.

[Source: iCodeBlog]

Would you like to learn iPhone and iPad programming online from professional instructors who have worked for companies such as EA and Disney Mobile?

Share and Enjoy:
  • RSS
  • Twitter
  • Facebook
  • DZone
  • HackerNews
  • del.icio.us
  • FriendFeed

Related Posts

Leave a Reply

blog comments powered by Disqus