ios - Delay timer with seconds interval after first request -
i have timer in application triggers event following method
mytimer = nstimer.scheduledtimerwithtimeinterval(10, target: self, selector: "searchfortruckdrivers:", userinfo:nil, repeats: true)
i notice triggers delay of 10 ms first time..i dont want delay user first time..but second request want delayed 10 ms.how can acheive this?
first schedule timer you've done.
mytimer = nstimer.scheduledtimerwithtimeinterval(10.0, target: self, selector: "searchfortruckdrivers:", userinfo: nil, repeats: true)
then, afterwards, fire mytimer
.
mytimer.fire()
according documentation,
you can use method fire repeating timer without interrupting regular firing schedule. if timer non-repeating, automatically invalidated after firing, if scheduled fire date has not arrived.
see nstimer class reference more information.
Comments
Post a Comment