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
Post a Comment