1、首先去https://github.com/jdg/MBProgressHUD下载包
创建项目,把包里的MBProgressHUD.h和MBProgressHUD.m源文件copy到您的项目中。
2、使用的类里面导入#import "MBProgressHUD.h"
3、在类中定义MBProgressHUD* progressTest;
创建:
progressTest = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:progressTest];
[self.view bringSubviewToFront:progressTest];
progressTest.mode = MBProgressHUDModeIndeterminate;
progressTest.animationType=MBProgressHUDAnimationZoom;
progressTest.delegate = self;
progressTest.labelText = @"加载中...";
[progressTest show:YES];
同效:
progressTest = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
progressTest.labelText = @"加载中...";
progressTest.mode = MBProgressHUDModeIndeterminate;可以显示不同风格的进度;
typedef enum {
/** Progress is shown using an UIActivityIndicatorView. This is the default. */
MBProgressHUDModeIndeterminate,
/** Progress is shown using a round, pie-chart like, progress view. */
MBProgressHUDModeDeterminate,
/** Progress is shown using a ring-shaped progress view. */
MBProgressHUDModeAnnularDeterminate,
/** Shows a custom view */
MBProgressHUDModeCustomView,
/** Shows only labels */
MBProgressHUDModeText
} MBProgressHUDMode;
/ **显示进度使用UIActivityIndicatorView。这是默认的。 * // **显示进度采用圆饼图,进步观。 * /
/**进展示出使用环形进度视图。 * /
/ **显示一个自定义视图* /
/ **仅显示标签* /