GithubHelp home page GithubHelp logo

imclab / svprogresshud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from svprogresshud/svprogresshud

0.0 1.0 0.0 229 KB

A clean and lightweight progress HUD for your iOS app.

Home Page: http://samvermette.com/199

License: Other

svprogresshud's Introduction

SVProgressHUD

SVProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task.

SVProgressHUD

Installation

From CocoaPods

Add pod 'SVProgressHUD' to your Podfile or pod 'SVProgressHUD', :head if you're feeling adventurous.

Manually

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.

  • Drag the SVProgressHUD/SVProgressHUD folder into your project.
  • Add the QuartzCore framework to your project.

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]).

Showing the HUD

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;
SVProgressHUDMaskType

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)
};

Dismissing the HUD

It can be dismissed right away using:

+ (void)dismiss;

If you'd like to stack HUDs, you can balance out every show call using:

+ (void)popActivity;

The HUD will get dismissed once the popActivity calls will match the number of show calls.

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

Credits

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.

svprogresshud's People

Contributors

alloy avatar benoit-pereira-da-silva avatar bobbypage avatar gcamp avatar georgbachmann avatar golergka avatar inamiy avatar itavero avatar jcoleman avatar jparise avatar julienp avatar jwilling avatar lifedim avatar massimobio avatar pluton8 avatar samvermette avatar sguillope avatar spenrose avatar tomguthrie avatar

Watchers

 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.