Giter Club home page Giter Club logo

svprogresshud's Introduction

SVProgressHUD

SVProgressHUD is an easy-to-use, clean and lightweight 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 ([SVProgressHUD show], [SVProgressHUD dismiss], etc.)
  • optional loading, success and error status messages
  • automatic positioning based on device type, orientation and keyboard visibility
  • 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.
  • 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)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 also activates the network activity indicator (this makes sense for apps that make a lot of network operations). If you’d like SVProgressHUD to not show the network indicator by default, you can add -DSVPROGRESSHUD_DISABLE_NETWORK_INDICATOR to your project’s CFLAGS (in build settings). You can also set this on a per-call basis, using the show methods that boast a networkIndicator parameter.

Automatic Reference Counting (ARC) support

Maintaining an official ARC branch has proven to be too much work, often leading to confusion since the ARC branch is always a few commits behind. If you’d like to use SVProgressHUD in your ARC-enabled project, you’ll have to add the -fno-objc-arc compiler flag to all of SVProgressHUD’s files.

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.

svprogresshud's People

Contributors

samvermette avatar gcamp avatar bobbypage avatar inamiy avatar alloy avatar

Stargazers

mrtn jcl avatar

Watchers

mrtn jcl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.