moshikafya
moshikafya

Reputation: 3320

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.

Upvotes: 2

Views: 3231

Answers (2)

Deepesh
Deepesh

Reputation: 8053

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

Upvotes: 1

mstottrop
mstottrop

Reputation: 589

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.

Upvotes: 0

Related Questions