• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
problems resetting timer interval.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems resetting timer interval.


  • Subject: problems resetting timer interval.
  • From: Memo Akten <email@hidden>
  • Date: Thu, 29 Jan 2009 22:07:51 +0000

Hi All, I'd like a function that sets up a timer, and can also change the frequency, but I just can't get it to work. If I call it more than once it just stops calling the timerLoop function altogether. I've tried so many things including not actually scheduling the timer in the setFrameRate function, but just saving the desired frameRate and setting a flag to notify that its changed, and in the next frame changing the time. I"ve tried not using the conveniance method but manually allocing the timer and adding to the current runloop, and releasing the old one before allocing the new one. But always same problem. First call to the function works, second and more calls don't. What am I doing wrong?

The function in its simplest form is below. How can I achieve what I want?

-(void) setFrameRate:(float)frameRate {
[timer invalidate];
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0f / frameRate) target:self selector:@selector(timerLoop) userInfo:nil repeats:YES];
}



Cheers,



Memo (Mehmet S. Akten)
	www.memo.tv
www.twitter.com/memotv
www.vimeo.com/memotv


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: problems resetting timer interval.
      • From: Ron Fleckner <email@hidden>
  • Prev by Date: Re: NSTask Leaking...
  • Next by Date: Re: -finstrument-functions and program startup
  • Previous by thread: Re: Partially Transparent windows
  • Next by thread: Re: problems resetting timer interval.
  • Index(es):
    • Date
    • Thread