2

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.

Irfan
  • 4,301
  • 6
  • 29
  • 46
moshikafya
  • 3,190
  • 5
  • 22
  • 27

2 Answers2

1

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

Deepesh
  • 8,065
  • 3
  • 28
  • 45
0

You may take a look at this answer, or ask the developer over at Github. Also, it is never a good idea to block the main-thread. Call it in a different thread. Go for Grand Central Dispatch.

Community
  • 1
  • 1
mstottrop
  • 589
  • 5
  • 21