If your project doesn't use ARC: you must add the -fobjc-arc
compiler flag to SVProgressHUD.m
in Target Settings > Build Phases > Compile Sources.
SVProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task.
- Drag the
SVProgressHUD/SVProgressHUD
folder into your project. - Add the QuartzCore framework to your project.
If you plan on using SVProgressHUD in a lot of places inside your app, I recommend importing it directly inside your prefix file.
(see sample Xcode project in /Demo
)
SVProgressHUD is created as a singleton (i.e. it doesn't need to be explicitly allocated and instantiated; you directly call [SVProgressHUD method]
).
You can show the status of indeterminate tasks using:
+ (void)show;
+ (void)showWithMaskType:(SVProgressHUDMaskType)maskType;
+ (void)showWithStatus:(NSString*)string;
+ (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType;
If you'd like the HUD to reflect the progress of a task, use:
+ (void)showProgress:(CGFloat)progress;
+ (void)showProgress:(CGFloat)progress status:(NSString*)status;
+ (void)showProgress:(CGFloat)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;
You can optionally disable user interactions while the HUD is shown using the maskType
property:
enum {
SVProgressHUDMaskTypeNone = 1, // allow user interactions, don't dim background UI (default)
SVProgressHUDMaskTypeClear, // disable user interactions, don't dim background UI
SVProgressHUDMaskTypeBlack, // disable user interactions, dim background UI with 50% translucent black
SVProgressHUDMaskTypeGradient // disable user interactions, dim background UI with translucent radial gradient (a-la-alertView)
};
It can be dismissed right away using:
+ (void)dismiss;
Or show a confirmation glyph before before getting dismissed 1 second later using:
+ (void)showSuccessWithStatus:(NSString*)string;
+ (void)showErrorWithStatus:(NSString *)string;
+ (void)showImage:(UIImage*)image status:(NSString*)string; // use 28x28 white pngs
SVProgressHUD is brought to you by Sam Vermette and contributors to the project. The success and error icons are from Glyphish. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by creating new issues. If you're using SVProgressHUD in your project, attribution would be nice.