Code Monkey home page Code Monkey logo

wsprogresshud's Introduction

WSProgressHUD

This is a beauful hud view for iPhone & iPad

CI Status Version License Platform Carthage compatible

Example

Usage

To Download the project. Run the WSProgressHUD.xcodeproj in the demo directory.

    [WSProgressHUD show];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        ...

        dispatch_async(dispatch_get_main_queue(), ^{
        ...
        [WSProgressHUD dismiss];
        });
    });

//Show on the self.view

@implementation ViewController
{
    WSProgressHUD *hud;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //Add HUD to view
    hud = [[WSProgressHUD alloc] initWithView:self.navigationController.view];
    [self.view addSubview:hud];

    //show
    [hud showWithString:@"Wating..." maskType:WSProgressHUDMaskTypeBlack];

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [hud dismiss];
    });

}

//Show on the window
    //show
    [WSProgressHUD show];

    //Show with mask
    [WSProgressHUD showWithMaskType:WSProgressHUDMaskTypeBlack];
    
    //Show with mask without tabbar
    [WSProgressHUD showWithStatus:@"Loading..." maskType:WSProgressHUDMaskTypeBlack maskWithout:WSProgressHUDMaskWithoutTabbar];
    
    //Show with string
    [WSProgressHUD showWithStatus:@"Loading..."];

    //Show with facebook shimmering
    [WSProgressHUD showShimmeringString:@"WSProgressHUD Loading..."];

    //Show with Progress
    [WSProgressHUD showProgress:progress status:@"Updating..."];

    //Show with image
    [WSProgressHUD showSuccessWithStatus:@"Thanks.."];
    
    //Show with string
    [WSProgressHUD showImage:nil status:@"WSProgressHUD"]

    //Dismiss
    [WSProgressHUD dismiss];
    
    //And There have 3 indicator style for your choice
    [WSProgressHUD setProgressHUDIndicatorStyle:WSProgressHUDIndicatorSmall] //small custom spinner

Installation

From CocoaPods

WSProgressHUD is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'WSProgressHUD'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate WSProgressHUD into your Xcode project using Carthage, specify it in your Cartfile:

github "devSC/WSProgressHUD"

Run carthage update to build the framework and drag the built WSProgressHUD.framework (in Carthage/Build/iOS folder) into your Xcode project (Linked Frameworks and Libraries in Targets).

Manually

Drag the WSProgressHUD/Demo/WSProgressHUD folder into your project. Then take care that WSProgressHUD.bundle is added to Targets->Build Phases->Copy Bundle Resources. Add the QuartzCore framework to your project.

Swift

Even though WSProgressHUD is written in Objective-C, it can be used in Swift with no hassle. If you use CocoaPods add the following line to your Podfile:

use_frameworks!

If you added WSProgressHUD manually, just add a bridging header file to your project with the WSProgressHUD header included.

Thanks

@Shimmering @SVProgressHUD @MMMaterialDesignSpinner

Author

Wilson-Yuan, [email protected]

License

WSProgressHUD is available under the MIT license. See the LICENSE file for more info.

wsprogresshud's People

Contributors

bryant1410 avatar devsc avatar jcgsxr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wsprogresshud's Issues

dismiss 方法执行后没有“立刻”消失,导致后面show出来的alert瞬间消失

当前的场景是,开始网络请求,转菊花,响应之后结束菊花,同时开始进行数据验证,验证错误弹出text alert,3秒之后让其消失。

可是现在的效果是,结束菊花后,菊花没有立刻消失,等到验证错误弹出后才消失,导致现在验证错误只显示了一瞬间。

示例代码大概是这样,请问是我用法有误吗?

[WSProgressHUD show];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    [WSProgressHUD dismiss];
    [WSProgressHUD showImage:nil status:@"晕???"];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [WSProgressHUD dismiss];
    });
});

加在view上,dismiss后没有在view上移除导致内存泄漏

比如如下写法:

WSProgressHUD *hud = [[WSProgressHUD alloc]initWithView:view];
[view addSubview:hud];
[hud showImage:nil status:text maskType:WSProgressHUDMaskTypeDefault];

显示后会自动调用dismiss方法。但是该方法中没有[self removeFromSuperview]。导致hud一直存在view上,占用内存
不知道我的使用方法是否有误,如果有误,请指正

WSProgressHUDMaskTypeClear

case WSProgressHUDMaskTypeClear: {
CGContextRef context = UIGraphicsGetCurrentContext();
[[UIColor colorWithWhite:0 alpha:0.5] set];
CGRect bounds = self.bounds;
CGContextFillRect(context, bounds);
aplha 应该为0

hud 消失没有回调

很多时候,需要在hud消失之后,接下来做其他的操作~
hud消失没有回调,用起来有点缺失的感觉~
昐回

Toast消失问题

如果点击出现了一个透明指示层,在它即将消失的时候,同一页面点击其他可以触发透明指示层的按钮,新出现的Toast刚刚出现就会和即将消失的Toast一起消失掉

Add Shimmering as a Podspec dependency

I think it's safer to have Shimmering as a dependency on your Podspec. Otherwise one can get duplicate symbol errors they are already using Shimmering in their project.

pod codes is different with your demo code?

there are some methods for show images in cocopods

#pragma mark - Show image

+ (void)showSuccessWithStatus: (NSString *)string
{
    [self showImage:WSProgressHUDSuccessImage status:string];
}

+ (void)showErrorWithStatus: (NSString *)string
{
    [self showImage:WSProgressHUDErrorImage status:string];
}


+ (void)showImage:(UIImage *)image status:(NSString *)title
{
    [self showImage:image status:title maskType:WSProgressHUDMaskTypeDefault];
}

+ (void)showImage:(UIImage *)image status:(NSString *)title maskType: (WSProgressHUDMaskType)maskType
{
    [self showImage:image status:title maskType:maskType maskWithout:WSProgressHUDMaskWithoutDefault];
}

methods for show images in demo

#pragma mark - Show image

+ (void)showSuccessWithStatus: (NSString *)string
{
    [[self shareInstance] addOverlayViewToWindow];
    [self showImage:WSProgressHUDSuccessImage status:string];
}

+ (void)showErrorWithStatus: (NSString *)string
{
    [[self shareInstance] addOverlayViewToWindow];
    [self showImage:WSProgressHUDErrorImage status:string];
}

+ (void)showImage:(UIImage *)image status:(NSString *)title
{
    [[self shareInstance] addOverlayViewToWindow];
    [self showImage:image status:title maskType:WSProgressHUDMaskTypeDefault];
}

+ (void)showImage:(UIImage *)image status:(NSString *)title maskType: (WSProgressHUDMaskType)maskType
{
    [[self shareInstance] addOverlayViewToWindow];
    [self showImage:image status:title maskType:maskType maskWithout:WSProgressHUDMaskWithoutDefault];
}

addOverlayViewToWindow didn't called obviously.
this issue will cause the bug which can't show WSProgressHUDSuccessImage or WSProgressHUDErrorImage when call [WSProgressHUD showErrorWithStatus:@"msg"]; or [WSProgressHUD showSuccessWithStatus:@"msg"]

my environment: Xcode7.2.1, iOS9.2, pod version:1.1.0

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.