MBProgressHUDis an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, privateUIKitUIProgressHUDwith some additional features.
方法 使用
// 填加到提供的view上 ,并显示它。 与之对应的方法 是 hideHUDForView:animated:.
如果 animated 设置为 YES the HUD 显示的时候 用 当前的animationType 如果 为no 则不用。
+ (MB_INSTANCETYPE)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
// Finds the top-most HUD subview and hides it ;该方法设置了 removeFromSuperViewOnHide , 当 the HUD hidden 时 自动 被 removed ;@return YES if a HUD was found and removed, NO otherwise.
+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
//Finds all the HUD subviews and hides them;The HUDs will automatically be removed from the view hierarchy when hidden;return the number of HUDs found and removed.
+ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated;
用法:
[MBProgressHUDshowHUDAddedTo:self.viewanimated:YES];dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW,0), ^{// Do something...dispatch_async(dispatch_get_main_queue(), ^{ [MBProgressHUDhideHUDForView:self.viewanimated:YES]; });});