Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A clean and lightweight progress HUD for your iOS app.
Objective-C Ruby
branch: master

This branch is 46 commits ahead, 388 commits behind TransitApp:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Demo
SVProgressHUD
.gitignore
LICENSE.txt
README.textile
SVProgressHUD.podspec

README.textile

SVProgressHUD

SVProgressHUD is a clean, lightweight and unobtrusive progress HUD for iOS. It’s a simplified and prettified alternative to the popular MBProgressHUD. Its fade in/out animations are highly inspired on Lauren Britcher’s HUD in Tweetie for iOS. The success and error icons are from Glyphish.

SVProgressHUD features:

  • very simple singleton convenience methods
  • optional loading, success and error status messages
  • automatic positioning based on device type, orientation, keyboard visibility and optional posY parameter
  • talks with setNetworkActivityIndicatorVisible (default can be changed via SVProgressHUDShowNetworkIndicator constant)
  • optionally disable user interactions while the HUD is showing with the maskType parameter

Installation

  • Drag the SVProgressHUD/SVProgressHUD folder into 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)showWithStatus:(NSString*)status;
+ (void)showWithStatus:(NSString*)status networkIndicator:(BOOL)show;
+ (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;
+ (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType networkIndicator:(BOOL)show;
+ (void)showWithMaskType:(SVProgressHUDMaskType)maskType;
+ (void)showWithMaskType:(SVProgressHUDMaskType)maskType networkIndicator:(BOOL)show;

The previous showInView: methods are deprecated. Using them with this version of SVProgressHUD will ignore the view and posY parameters, which are now automatically determined by the class.

You dismiss it using one of these:

+ (void)dismiss;
+ (void)dismissWithSuccess:(NSString*)successString;
+ (void)dismissWithSuccess:(NSString*)successString afterDelay:(NSTimeInterval)seconds;
+ (void)dismissWithError:(NSString*)errorString;
+ (void)dismissWithError:(NSString*)errorString afterDelay:(NSTimeInterval)seconds;

If you’re using SVProgressHUD to show the status of a many-steps operation, you can also change the HUD status while it’s showing with:

+ (void)setStatus:(NSString*)string;

Additionally, you can use SVProgressHUD to display a simple confirmation/success HUD using:

+ (void)showSuccessWithStatus:(NSString*)string;

SVProgressHUDMaskType

You can optionally disable user interactions and dim the background UI 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)
};

Network activity indicator

By default, showing SVProgressHUD will also show the network activity indicator (this makes sense for apps that make a lot of network operations). You can change this behavior by setting the SVProgressHUDShowNetworkIndicator constant to 0 in SVProgressHUD.h.

Automatic Referencing counting (ARC) support

SVProgressHUD has an ARC branch thanks to bryanveloso. If you’d like to use the non-arc version in your ARC project, you can disable ARC on a per-file basis by adding the -fno-objc-arc compiler flag for those files (see this StackOverflow thread for reference).

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.

Something went wrong with that request. Please try again.