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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -