0

我有一个NSTimer这样的:

[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(sliderUpdate:) userInfo:nil repeats:YES];

-(void)sliderUpdate:(id)sender
{
    int currentTime = (int)((newPlayer.currentTime.value)/newPlayer.currentTime.timescale);
    slider.value=currentTime;
    NSLog(@"%i",currentTime);
    song.currentTime=currentTime;
    int currentPoint=(int)((newPlayer.currentTime.value)/newPlayer.currentTime.timescale);
    int pointMins=(int)(currentPoint/60);
    int pointSec=(int)(currentPoint%60);
    NSString *strMinlabel=[NSString stringWithFormat:@"%02d:%02d",pointMins,pointSec];
    lblSlidermin.text=strMinlabel;
    song.strslidermin=strMinlabel;
}

我想要做的是,每 45 秒调用一次 Web 服务:

示例:45 秒内第一次调用,90 秒内第二次,等等。

我怎样才能在这个 NSTimer 中做到这一点?

4

1 回答 1

0

您只需修改 NSTimer 45 秒:

[NSTimer scheduledTimerWithTimeInterval:45 target:self selector:@selector(sliderUpdate:) userInfo:nil repeats:YES];
于 2013-10-07T02:43:01.110 回答