这个第三方和MBProgressHUD差不多,也挺简单的。

//
//  ViewController.m
//  ProgressHUD
//
//  Created by City--Online on 15/6/15.
//  Copyright (c) 2015年 City--Online. All rights reserved.
//

#import "ViewController.h"
#import "SVProgressHUD.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handleNotification:)
                                                 name:SVProgressHUDWillAppearNotification
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handleNotification:)
                                                 name:SVProgressHUDDidAppearNotification
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handleNotification:)
                                                 name:SVProgressHUDWillDisappearNotification
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handleNotification:)
                                                 name:SVProgressHUDDidDisappearNotification
                                               object:nil];
}
- (void)handleNotification:(NSNotification *)notif
{
    NSLog(@"Notification recieved: %@", notif.name);
    NSLog(@"Status user info key: %@", [notif.userInfo objectForKey:SVProgressHUDStatusUserInfoKey]);
}

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton *btn=[UIButton buttonWithType:UIButtonTypeSystem];
    [btn setTitle:@"提示框" forState:UIControlStateNormal];
    btn.frame=CGRectMake(, , , );
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
}
-(void)btnClick:(id)sender
{

//    [SVProgressHUD showWithStatus:@"Loading"];

//    [SVProgressHUD show];
//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//        sleep(3);
//        dispatch_async(dispatch_get_main_queue(), ^{
//            [SVProgressHUD dismiss];
//        });
//    });

//    [self showWithProgress];

    [self showSuccess];
}
static float progress = 0.0f;
- (void)showWithProgress {
    progress = 0.0f;
    [SVProgressHUD showProgress: status:@"Loading"];
    [self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3f];
}

- (void)increaseProgress {
    progress+=0.1f;
    [SVProgressHUD showProgress:progress status:@"Loading"];

    if(progress < 1.0f)
        [self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3f];
    else
        [self performSelector:@selector(dismiss) withObject:nil afterDelay:0.4f];
}
- (void)dismiss {
    [SVProgressHUD dismiss];
}

- (void)showInfo{
    [SVProgressHUD showInfoWithStatus:@"Useful Information."];
}

- (void)showSuccess {
    [SVProgressHUD showSuccessWithStatus:@"Great Success!"];
}

- (void)showError {
    [SVProgressHUD showErrorWithStatus:@"Failed with Error"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

IOS第三方之SVProgressHUD的更多相关文章

  1. iOS 第三方库、插件、知名博客总结

    iOS 第三方库.插件.知名博客总结 用到的组件 1.通过CocoaPods安装 项目名称 项目信息 AFNetworking 网络请求组件 FMDB 本地数据库组件 SDWebImage 多个缩略图 ...

  2. 超全!整理常用的iOS第三方资源(转)

    超全!整理常用的iOS第三方资源 一:第三方插件 1:基于响应式编程思想的oc 地址:https://github.com/ReactiveCocoa/ReactiveCocoa 2:hud提示框 地 ...

  3. iOS第三方库管理工具

    作者:彷徨iOS 原文地址1:http://iostree.sinaapp.com/?p=78 原文地址2:http://blog.csdn.net/wzzvictory/article/detail ...

  4. fir.im Weekly - 热门 iOS 第三方库大盘点

    本期 fir.im Weekly 收集的热度资源,大部分关于Android.iOS 开发工具.源码和脑洞大开的 UI 动画,希望给你带来更多的工作创意与灵感. 盘点国内程序员不常用的热门iOS第三方库 ...

  5. ios 第三方登录

    ios 第三方登录通常的做法是, 1.登录后,获得第三方的uid,调用服务器登录接口,如服务器返回无此用户,转2,有此用户,转3. 2.服务器返回无此用户,需完善用户资料,如果完成,则在服务器创建与第 ...

  6. 你一定能用的上的iOS第三方库

    点国内程序员不常用的热门iOS第三方库:看完,还敢自称"精通iOS开发"吗? 综合github上各个项目的关注度与具体使用情况,涵盖功能,UI,数据库,自动化测试,编程工具等类型, ...

  7. iOS第三方库

    热门iOS第三方库:看完,还敢自称”精通iOS开发”吗? 综合github上各个项目的关注度与具体使用情况,涵盖功能,UI,数据库,自动化测试,编程工具等类型,看完,还敢自称”精通iOS开发”吗? h ...

  8. iOS开发进阶 - 使用Carthage管理iOS第三方库

    移动端访问不佳,请访问我的个人博客 最近在研究Swift,一不小心发现一个好的的管理iOS第三方库Carthage,就跟第一次使用CocoaPods时一样兴奋不已,在研究了大半天后终于能用了,使用起来 ...

  9. iOS第三方Api及常用框架总结

    iOS常用框架汇总: SVProgressHUD:产生覆盖层,禁止某种操作 SDWebImage: 专业下载图片框架 AFN:网络数据请求框架 MJExtension,模型对象之间互转 第三方分享第三 ...

随机推荐

  1. 疑难杂症--SQL SERVER 2012下数据库内存异常回收

    --=================================================================== --背景: 在一台SQL SERVER 2012 SP1(1 ...

  2. 单线程任务 Task.Factory.StartNew 封装

    代码: using log4net; using SunCreate.CombatPlatform.Security; using System; using System.Collections.G ...

  3. item style edit in sharepoint 2013

    标题头添加属性:(如果需要使用ddwrt)xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime&quo ...

  4. 解决创建带有NameSpace的XML文件出现空白xmlns的问题

    为了能够让用户自行部署ClickOnce应用程序,需要编写一个生成ClickOnce应用程序的ClickOnce专用安装程序setup.exe,而生成这个setup.exe的方法就是编写一个XML格式 ...

  5. sqlServer数据库纵横表相互转化

    sqlServer  数据库纵横表相互转化 一.纵表转横表: 1.纵表: 2.横表: 3. 代码: select Name as '姓名', end) as '语文', end) as '数学', e ...

  6. 201621123018《Java程序设计》第3周学习报告

    Week03-面向对象入门 1. 本周学习总结 初学面向对象,会学习到很多碎片化的概念与知识.尝试学会使用思维导图将这些碎片化的概念.知识点组织起来.请使用工具画出本周学习到的知识点及知识点之间的联系 ...

  7. jzoj5805

    #include<bits/stdc++.h> using namespace std; int x,n,pp,ct[10000]; long double f[210][(1<&l ...

  8. 内核漏洞学习—熟悉HEVD

    一直以来内核漏洞安全给很多人的印象就是:难,枯燥.但是内核安全是否掌握是衡量一个系统安全工程师水平的标准之一,也是安全从业人员都应该掌握的基本功.本文通过详细的实例带领读者走进内核安全的大门.难度系数 ...

  9. 客户端集成IdentityServer4

    1. vs code 终端执行  dotnet new webapi --name ClientCredentialApi 2. 找到ValuesController.cs 引用  using Mic ...

  10. cobbler 自定义安装系统

    1.自定义安装系统(根据mac地址)--name=定义名称--mac=客户端的mac地址--ip-address=需求的ip--subnet=掩码 --gateway=网关--interface=网口 ...