Accessing NSTimer object added to NSRunLoop object
Accessing NSTimer object added to NSRunLoop object
- Subject: Accessing NSTimer object added to NSRunLoop object
- From: Dragan MiliÄ <email@hidden>
- Date: Sun, 14 Mar 2004 20:25:38 +0100
Hi!
Is there any way to access instances of NSTimer class, added to an
instance of NSRunLoop class, without importing CoreFoundation framework
and messing with CFRunLoop and CFRunLoopTimer classes. What I want to
achieve is to remove all timers previously added to currentRunLoop
object and prevent them from firing, before adding the new one. This
fragment of code will make it more clear:
- (void)tableViewSelectionDidChange:(NSNotification *)notification
{
...
...
int selectedRow = [[self themeTableView] selectedRow];
NSTimer *readMessageTimer = [NSTimer timerWithTimeInterval:1.5
target:self
selector:@selector(fireTimer:)
userInfo:[NSNumber numberWithInt:selectedRow]
repeats:NO];
NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop];
// HERE, ALL TIMER PREVIOUSLY ADDED TO currentRunLoop SHOULD BE REMOVED
// SINCE I HAVE NO REFERENCE TO THEM TO CALL invalidate:
[currentRunLoop addTimer:readMessageTimer
forMode:NSDefaultRunLoopMode];
...
...
}
TIA,
Milke.
_______________________________________________
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.