Search code examples
iphoneobjective-ciosxcodembprogresshud

MBProgressHUD issue in main thread.


I would like to use MBProgressHUD the following way: In my method I call multiple servers and other actions that require showing a HUD. I was wondering what would be the best way to "hold" the main thread until those particular actions are done.

For example:

method {

MBProgressHUD (action 1) //don't move on until this is done

//some other code...

MBProgressHUD (action 2)

//some other code...

} 

I am pretty new to iOS so sorry if this is too simple. thank you.


Solution

  • I think you use graphical change in MBProgressHUD.

    example :-

    [HUD showWhileExecuting:@selector(fetchNewData) onTarget:self withObject:nil animated:YES];
    

    fetchNewData will be called on secondary thread . so no use graphical change in MBProgressHUD.

    if you want to graphical change use in hudWasHidden delegete