您使用的是哪個版本的MBProgressHUD
?在v0.4(最後一次),沒有這樣的方法。取而代之的是showWhileExecuting
,它說:
/**
* Shows the HUD while a background task is executing in a new thread, then hides the HUD.
*
* This method also takes care of NSAutoreleasePools so your method does not have to be concerned with setting up a
* pool.
*
* @param method The method to be executed while the HUD is shown. This method will be executed in a new thread.
* @param target The object that the target method belongs to.
* @param object An optional object to be passed to the method.
* @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use
* animations while disappearing.
*/
- (void)showWhileExecuting:(SEL)method
onTarget:(id)target
withObject:(id)object
animated:(BOOL)animated;
你應該做的是隻顯示HUD,並刪除它時,代表被解僱。你應該運行連接,而不是改進格式。只要你使用異步連接,一切都會好的。
類似於this。
此外,最新的MBProgressHUD演示應用程序還包含一個NSURLConnection示例:https://github.com/matej/MBProgressHUD/blob/master/Demo/Classes/HudDemoViewController.m#L208 – 2011-06-17 13:30:13