Search code examples
iphoneios4nstimernstimeinterval

Setting Timerinterval fast then gradually it is slow down


i have the following code:

xx=0.50;
[NSTimer scheduledTimerWithTimeInterval:xx target:self selector:@selector(ontimer:) userInfo:nil repeats:YES];

-(void)ontimer
{
    xx=xx+0.05;
    NSTimeInterval dt = [timer timeInterval];
    // do something
}

I want to call ontimer for 0.50 then 0.55 then 0.60 & soon. that means First Fast then gradually slow down.

The Problem is each Time ontimer will be called for 0.50 seconds.

Thanks in Advance.


Solution

  • Have you tried setting your time variable to static?