NSAlert with NSTimer
Hi,
I am facing a problem to display NSAlertPanel dialog with NSTimer.
Actually, I need to display a alert panel which show the remaining time to happened something(like restart the system). My problem is- it is not updating the time until I click on any button of panel. Here is the code I am using-
[self remainingTime: 30];
- (void) remainingTime: (int) timeOut
{
msg = [NSString stringWithFormat: @"%d seconds remaining", timeOut];
NSRunAlertPanel(@"temp",msg , @"Accept", nil, @"Reject");
NSTimer* myTimer = [NSTimer timerWithTimeInterval: 1
target: self selector: @selector(timeUpdater:)
userInfo : nil repeats: NO];
[myTimer fire];
[[NSRunLoop currentRunLoop] addTimer: myTimer forMode:NSModalPanelRunLoopMode];
}
- (void) timeUpdater: (NSTimer*) theTimer
{
timeOut--;
if(timeOut <= 0)
[theTimer invalidate];
[self remainingTime: timeOut];
}
any help will be highly appreciated
Thanks!