Skip to content

martiancraft/SVProgressHUD

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important note 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 an easy-to-use, clean and lightweight progress HUD for iOS. It’s a simplified and prettified alternative to the popular MBProgressHUD. The success and error icons are from Glyphish.

SVProgressHUD features:

  • very simple singleton convenience methods ([SVProgressHUD show], [SVProgressHUD dismiss], etc.)
  • display of status strings and/or images to quickly communicate the state of the ongoing task
  • automatic positioning based on device type, orientation and keyboard visibility
  • optionally disable user interactions for ongoing tasks using a maskType parameter

Installation

  • 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.

Usage

(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]) and can be shown using one of the following convenience/class methods:

+ (void)show;
+ (void)showWithMaskType:(SVProgressHUDMaskType)maskType;
+ (void)showWithStatus:(NSString*)string;
+ (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType;

It can be dismissed using:

+ (void)dismiss;

Optionally, you can have the HUD display a status and/or an image glyph before automatically getting dismissed 1s later (not customizable anymore to discourage lenghty status strings — for which UIAlertViews would be more appropriate).

+ (void)showSuccessWithStatus:(NSString*)string;
+ (void)showErrorWithStatus:(NSString *)string;
+ (void)showImage:(UIImage*)image status:(NSString*)string; // use 28x28 white pngs

SVProgressHUDMaskType

You can optionally disable user interactions while a task is being completed by using the show methods that support 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)
};

Credits

SVProgressHUD is brought to you by Sam Vermette and contributors to the project. 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.

About

A clean and lightweight progress HUD for your iOS app.

Resources

License

Stars

Watchers

Forks

Packages

No packages published