ios - How can I add a delay before it continues -


is there way in normal obj-c or cocos2d make delay inside if-else block?

if ([self isvalidtilecoord:ctilecoord] && ![self iswallattilecoord:ctilecoord]) {     [self addchild:circle0];     //wait 2 seconds     //perform task } 

just simple lag wait between 2 tasks, or stalling action. there simple way this?

you can use performselector: withobject: afterdelay: method delay tasks:

if ([self isvalidtilecoord:ctilecoord] && ![self iswallattilecoord:ctilecoord]) {     [self addchild:circle0];     //wait 2 seconds     [self performselector:@selector(continuetask) withobject:nil afterdelay:2.0];  } 

and in selector method:

-(void)continuetask {     //perform task } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -