ios - Button won't hide before loop -


i have button attached ibaction supposed hide before loop, never hides.

- (ibaction)method:(id)sender {     button.hidden = yes;     while(...) //button should hidden while control in loop never happens.     {     } } 

not sure why isn't working appreciated.

you've set hidden property, view doesn't draw right then. must go through iteration of run loop redraw contents. if have long running synchronous task in method, control never returns run loop until method exits, don't see effect of setting hidden property.

consider doing task asynchronously. like

button.hidden = yes; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{     while (...) {         // work here     } }); 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -