博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1。 网上下载  MBProgessHUD 类,导入到工程。

https://github.com/jdg/MBProgressHUD

 

 

 

2。#import "MBProgressHUD.h"

 

     类实现 MBProgressHUDDelegate 代理。

 

3。 在类里面定义:

 

      MBProgressHUDprogress_;

 

4。 显示;

      

  1. progress_ = [[MBProgressHUD alloc] initWithView:self.tableView];  
  2. [self.view addSubview:progress_];  
  3. [self.view bringSubviewToFront:progress_];  
  4. progress_.delegate = self;  
  5. progress_.labelText = @"加载中...";  
  6. [progress_ show:YES];  
 

 

 

       隐藏:

      

  1. if (progress_)   
  2. {  
  3.     [progress_ removeFromSuperview];  
  4.     [progress_ release];  
  5.     progress_ = nil;  
  6. }  
 

 

 

  5。实现协议:

      

  1. - (void)hudWasHidden:(MBProgressHUD *)hud   
  2. {  
  3.     NSLog(@"Hud: %@", hud);  
  4.     // Remove HUD from screen when the HUD was hidded  
  5.     [progress_ removeFromSuperview];  
  6.     [progress_ release];  
  7.     progress_ = nil;  
  8.       
  9. }  
 

 

转http://blog.csdn.net/tangaowen/article/details/6528136
posted on 2011-08-28 15:21  Likwo  阅读(5541)  评论(0编辑  收藏  举报