• 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
Re: Sheets and NSTimer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sheets and NSTimer


  • Subject: Re: Sheets and NSTimer
  • From: Bjoern Kriews <email@hidden>
  • Date: Mon, 23 Feb 2004 00:52:39 +0100

On 22.02.2004, at 22:01, David Dauer wrote:

Hello

I've got a little problem using an NSTimer while running a sheet.
I tried to create the timer using

myTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self
selector:@selector(myTimerAction:) userInfo:nil repeats:YES] retain];

I suppose you need:

NSTimer *timer = [[NSTimer timerWithTimeInterval: 1.0 target: self selector: @selector(countDown:) userInfo: nil repeats: YES] retain];
[[NSRunLoop currentRunLoop] addTimer: timer forMode: NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer: timer forMode: NSModalPanelRunLoopMode];
...
[timer invalidate];
[timer release];

(I used this one with NSEventTrackingRunLoopMode to make my Timer fire while dragging a slider).

The docs say that only the timer... (not the scheduledTimer...) methods return a Timer that
you can add to run loop afterwards. I did this before and it worked - now your question
led to me fix a possible problem in my code.

Thanks for asking, Bjoern
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Sheets and NSTimer (From: David Dauer <email@hidden>)

  • Prev by Date: Re: Function overloading for ObjC classes
  • Next by Date: Make a splash screen in 2 minutes
  • Previous by thread: Re: Sheets and NSTimer
  • Next by thread: Animated GIF
  • Index(es):
    • Date
    • Thread