我有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秒就调用一次网络服务:
示例:第一次通话在45秒内,第二次在90秒内等等。
如何在此NSTimer中执行此操作?
答案 0 :(得分:0)
您只需修改NSTimer 45秒:
[NSTimer scheduledTimerWithTimeInterval:45 target:self selector:@selector(sliderUpdate:) userInfo:nil repeats:YES];