Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSTimer Frustrations

NSTimer Frustrations
Thread Tools
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Apr 12, 2001, 10:40 PM
 
This should be something pretty simple but it is frustrating the hell out of me and I haven't been coding too much lately so I could be making very basic mistakes. Anyway, I was wondering if someone could post a few lines of code that would set up an NSTimer in very basic terms. I need it for some graphics routines and it is the only component that does not exist in one of my projects so this is very irritating.

Help me out please.
Spectral Class
"Shedding Light on Innovation"
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Apr 12, 2001, 10:51 PM
 
Sure.

Code:
NSTimer *repeatTimer; ... repeatTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(tick) userInfo:nil repeats:YES ] retain];
interval: Seconds, after which the timer will fire.
target: Who am I sending the method to?
selector: What method am I using?
userInfo: Additional info you may want to add.
repeats: After it fires, will it reset?
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Apr 12, 2001, 11:22 PM
 
Parallax, you are a genius!

This is exactly what I needed.

I owe you one,
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:05 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2