objective c - How to wait until code is done. iOS -


i can call selector code

[self performselector:<#(sel)#> onthread:<#(nsthread *)#> withobject:<#(id)#> waituntildone:<#(bool)#>] 

and thread wait until selector working (if set waituntildone:yes). question - can wait until code done?

for example. have subview, loads animation. animation duration 2 sec. , if make actions on background view, while animating, have error. i'd wait until animation over. , can't make selector, , use

[self performselector:<#(sel)#> onthread:<#(nsthread *)#> withobject:<#(id)#> waituntildone:<#(bool)#>] 

any suggestions? )

you can try way

-(void)waituntildone:(void(^)(void))waitblock {     //use statement or call method here     if(waitblock){         waitblock();     } } 

and need use as

[self.tableview waituntildone:^{     //call required method here                                             }]; 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -