Good day. In general, the essence is this: you need to suspend the charge with the propeller, i.e. When you press the button, wait for the view with the propeller of the type to wait, only then the transition to another controller occurs. So, tell me, please, how to stop this window for a couple of seconds, such as sis-ma picks up something for you ... I apologize in advance for my broken language

the code looks like this

- (IBAction)bottomSecondSearchAction:(id)sender { [SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // time-consuming task dispatch_async(dispatch_get_main_queue(), ^{ [SVProgressHUD dismiss]; }); }); } 

I try to insert [NSThread sleepForTimeInterval: 2], but it first falls asleep, and then for a second pops up the window and the transition, respectively ...

  • one
    @ byldog05; To format a code, select it with the mouse and click on the {} button of the editor. - alvoro
  • @alvoro, Thank you - byldog05

1 answer 1

It is necessary to hide the indicator (propeller, chamomile, twist) in such a block (instead of the nested dispatch_async):

 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(<some_seconds> * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [SVProgressHUD dismiss]; });