2012-05-04 21 views
2

我想通过以下方式使用MBProgressHUD:在我的方法中,我调用多个服务器和其他需要显示HUD的操作。我想知道在这些特定操作完成之前,“保持”主线程的最佳方式是什么。主线程中的MBProgressHUD问题。

例如:

method { 

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

//some other code... 

MBProgressHUD (action 2) 

//some other code... 

} 

我非常新到iOS很抱歉,如果这是太简单了。谢谢。

回答

1

我觉得you use graphical change in MBProgressHUD.

例如: -

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

fetchNewData将在二级线程调用。所以MBProgressHUD中的no use graphical change

如果你想图形更改使用hudWasHidden delegete

0

你可以看看this答案,或者向Github咨询开发人员。此外,阻止主线程永远不是一个好主意。在另一个线程中调用它。去大中央调度。

+0

我看过。恐怕没什么帮助,但是谢谢。 – moshikafya