Is there a way to call a block with a primitive parameter after a delay, like using performSelector:withObject:afterDelay:
but with an argument like int
/double
/float
?
Ios – How to trigger a block after a delay, like -performSelector:withObject:afterDelay:
grand-central-dispatchiosobjective cobjective-c-blocks
Best Answer
I think you're looking for
dispatch_after()
. It requires your block to accept no parameters, but you can just let the block capture those variables from your local scope instead.More: https://developer.apple.com/documentation/dispatch/1452876-dispatch_after