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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -