objective c - Periodically call to a web service in ios -
i have nstimer
this:
[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; }
what want do, is, in each , every 45 seconds, call web service:
example: 1st call in 45 seconds, second in 90 seconds, etc.
how can in nstimer?
you have modify nstimer 45 seconds:
[nstimer scheduledtimerwithtimeinterval:45 target:self selector:@selector(sliderupdate:) userinfo:nil repeats:yes];
Comments
Post a Comment