• 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: NSTimer fires after invalidated - why?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer fires after invalidated - why?


  • Subject: Re: NSTimer fires after invalidated - why?
  • From: Shaun Wexler <email@hidden>
  • Date: Thu, 23 Mar 2006 01:30:14 -0800

On Mar 22, 2006, at 8:19 PM, Walt Horat wrote:

If a particular drawer is concealed when the user types, we want to open the
drawer and have it close after a period of time; each keystroke shall reset
the timer.

- (void)keyDown:(NSEvent *)event
{
if (!m_drawerCloseTimer) {
m_drawerCloseTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector (keyTimer:) userInfo:nil repeats:YES] retain];
[m_drawer open];
} else {
[m_drawerCloseTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:5.0]];
}
}


- (void)keyTimer:(NSTimer *)timer
{
    if (m_drawerCloseTimer == timer) {
        m_drawerCloseTimer = nil;
        [timer invalidate];
        [timer release];
        [m_drawer close];
    }
}

--
Shaun Wexler
MacFOH
http://www.macfoh.com

"Things should be described as simply as possible, but no simpler." - Albert Einstein


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSTimer fires after invalidated - why? (From: Walt Horat <email@hidden>)

  • Prev by Date: CoreData questions
  • Next by Date: Re: CoreData questions
  • Previous by thread: Re: NSTimer fires after invalidated - why?
  • Next by thread: Source files - subclassing a nstableview
  • Index(es):
    • Date
    • Thread