Lefora Free Forum
login join
Loading
409 views

NSAlert with NSTimer

Page 1
1–1
rookie - member
2 posts

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: (inttimeOut

{

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 currentRunLoopaddTimer: myTimer forMode:NSModalPanelRunLoopMode];

}

- (void) timeUpdater: (NSTimer*) theTimer

{

timeOut--;

if(timeOut <= 0)

        [theTimer invalidate];

[self remainingTimetimeOut];

}


any help will be highly appreciated

Thanks!

Page 1
1–1

Locked Topic


You must be a member to post in this forum

Join Now!