# SVProgressHUD
`SVProgressHUD` is a clean and easy-to-use HUD meant to display the progress of an ongoing task.
![SVProgressHUD](http://f.cl.ly/items/2G1F1Z0M0k0h2U3V1p39/SVProgressHUD.gif)
## Installation
### From CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like `SVProgressHUD` in your projects. Simply add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html):
```ruby
pod 'SVProgressHUD'
```
If you want to use the latest features of `SVProgressHUD` add `:head`:
```ruby
pod 'SVProgressHUD', :head
```
This pulls from the `master` branch directly. We are usually careful about what we push there and this is the version we use ourselves in all of our projects.
### Carthage
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/TransitApp/SVProgressHUD)
You can install SVProgressHUD with Carthage
### Manually
* Drag the `SVProgressHUD/SVProgressHUD` folder into your project.
* Take care that `SVProgressHUD.bundle` is added to `Targets->Build Phases->Copy Bundle Resources`.
* 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]`).
**Use `SVProgressHUD` wisely! Only use it if you absolutely need to perform a task before taking the user forward. Bad use case examples: pull to refresh, infinite scrolling, sending message.**
Using `SVProgressHUD` in your app will usually look as simple as this (using Grand Central Dispatch):
```objective-c
[SVProgressHUD show];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// time-consuming task
dispatch_async(dispatch_get_main_queue(), ^{
[SVProgressHUD dismiss];
});
});
```
### Showing the HUD
You can show the status of indeterminate tasks using one of the following:
```objective-c
+ (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 one of these:
```objective-c
+ (void)showProgress:(CGFloat)progress;
+ (void)showProgress:(CGFloat)progress status:(NSString*)status;
+ (void)showProgress:(CGFloat)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;
```
### Dismissing the HUD
It can be dismissed right away using:
```objective-c
+ (void)dismiss;
```
If you'd like to stack HUDs, you can balance out every show call using:
```objective-c
+ (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 a little bit later. The display time depends on the length of the given string (between 0.5 and 5 seconds).
```objective-c
+ (void)showInfoWithStatus:(NSString *)string;
+ (void)showInfoWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType;
+ (void)showSuccessWithStatus:(NSString*)string;
+ (void)showSuccessWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType;
+ (void)showErrorWithStatus:(NSString *)string;
+ (void)showErrorWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType;
+ (void)showImage:(UIImage*)image status:(NSString*)string;
+ (void)showImage:(UIImage*)image status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;
```
## Customization
`SVProgressHUD` can be customized via the following methods:
```objective-c
+ (void)setBackgroundColor:(UIColor*)color; // default is [UIColor whiteColor]
+ (void)setForegroundColor:(UIColor*)color; // default is [UIColor blackColor]
+ (void)setRingThickness:(CGFloat)width; // default is 4 pt
+ (void)setFont:(UIFont*)font; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]
+ (void)setInfoImage:(UIImage*)image; // default is the bundled info image provided by Freepik
+ (void)setSuccessImage:(UIImage*)image; // default is bundled success image from Freepik
+ (void)setErrorImage:(UIImage*)image; // default is bundled error image from Freepik
+ (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType; // default is SVProgressHUDMaskTypeNone
+ (void)setViewForExtension:(UIView*)view; // default is nil, only used if #define SV_APP_EXTENSIONS is set
```
## Notifications
`SVProgressHUD` posts four notifications via `NSNotificationCenter` in response to being shown/dismissed:
* `SVProgressHUDWillAppearNotification` when the show animation starts
* `SVProgressHUDDidAppearNotification` when the show animation completes
* `SVProgressHUDWillDisappearNotification` when the dismiss animation starts
* `SVProgressHUDDidDisappearNotification` when the dismiss animation completes
Each notification passes a `userInfo` dictionary holding the HUD's status string (if any), retrievable via `SVProgressHUDStatusUserInfoKey`.
`SVProgressHUD` also posts `SVProgressHUDDidReceiveTouchEventNotification` when users touch on the overall screen or `SVProgressHUDDidTouchDownInsideNotification` when a user touches on the HUD directly. For this notifications `userInfo` is not passed but the object parameter contains the `UIEvent` that related to the touch.
## App Extensions
When using `SVProgressHUD` in an App Extension, #define SV_APP_EXTENSIONS to avoid using unavailable APIs. Additionally call `setViewForExtension:` from your extensions view controller with `self.view`.
## Contributing to this project
If you have feature requests or bug reports, feel free to help out by sending pull requests or by [creating new issues](https://github.com/samvermette/SVProgressHUD/issues/new). Please take a moment to
review the guidelines written by [Nicolas Gallagher](https://github.com/necolas/):
* [Bug reports](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#bugs)
* [Feature requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#features)
* [Pull requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#pull-requests)
## Credits
`SVProgressHUD` is brought to you by [Sam Vermette](http://samvermette.com) and [contributors to the project](https://github.com/samvermette/SVProgressHUD/contributors). If you're using `SVProgressHUD` in your project, attribution would be very appreciated. The info, success and error icons are made by [Freepik](http://www.freepik.com) from [Flaticon](www.flaticon.com) and are licensed under [Creative Commons BY 3.0](http://creativecommons.org/licenses/by/3.0/).
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
仿爱鲜蜂源码-swift3.0 (923个子文件)
ios_open_sdk_2.9.3.2_iphone 0B
libWeiboSDK.a 11.58MB
libUMSocial_Sdk_4.4.a 9.13MB
libWeChatSDK.a 8.78MB
libSocialQQ.a 300KB
libSocialWechat.a 280KB
libSocialSinaSSO.a 108KB
AD 338B
mfp.cer 577B
countryList 826B
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
v2_pullRefresh.gif 5KB
.gitignore 182B
TencentOAuth.h 25KB
WeiboSDK.h 21KB
WBHttpRequest+WeiboUser.h 20KB
QQApiInterfaceObject.h 20KB
WXApiObject.h 19KB
TencentOAuthObject.h 15KB
UMSocialDataService.h 13KB
UIButton+WebCache.h 13KB
UMSocialSnsData.h 13KB
sdkdef.h 12KB
SDWebImageManager.h 11KB
UMSocialConfig.h 10KB
UIImageView+WebCache.h 10KB
TencentMessageObject.h 9KB
SDImageCache.h 8KB
UMSocialSnsPlatformManager.h 7KB
WBHttpRequest+WeiboGame.h 7KB
SDWebImageDownloader.h 7KB
UMSocialControllerService.h 6KB
UMSocialAccountManager.h 6KB
MKAnnotationView+WebCache.h 6KB
WBHttpRequest.h 6KB
UIImageView+HighlightedWebCache.h 5KB
WXApi.h 5KB
UMSocialBar.h 4KB
UMSocialSnsService.h 4KB
WBHttpRequest+WeiboShare.h 4KB
SDWebImagePrefetcher.h 4KB
WeiboUser.h 4KB
UMSocialData.h 4KB
SVProgressHUD.h 4KB
MJRefreshComponent.h 3KB
SDWebImageDownloaderOperation.h 3KB
WeiBoAPI.h 3KB
QQApiInterface.h 2KB
MJRefreshConst.h 2KB
TencentApiInterface.h 2KB
SDWebImageCompat.h 2KB
UMSocialControllerServiceComment.h 2KB
WBSDKRelationshipButton.h 1KB
MJRefreshFooter.h 1KB
WBHttpRequest+WeiboToken.h 1KB
WBSDKCommentButton.h 1KB
MJRefreshHeader.h 1KB
UIScrollView+MJRefresh.h 1KB
UMSocialQQHandler.h 1KB
UIView+WebCacheOperation.h 970B
UMSocial.h 871B
UIScrollView+MJExtension.h 833B
MJRefreshAutoFooter.h 828B
MJRefreshStateHeader.h 754B
UMSocialSinaSSOHandler.h 738B
UIView+MJExtension.h 690B
MJRefreshAutoStateFooter.h 573B
NSData+ImageContentType.h 565B
MJRefreshGifHeader.h 537B
MJRefreshBackStateFooter.h 534B
MJRefresh.h 532B
MJRefreshBackGifFooter.h 501B
MJRefreshAutoGifFooter.h 501B
UIImage+WebP.h 490B
SDWebImageDecoder.h 453B
MJRefreshBackNormalFooter.h 434B
MJRefreshNormalHeader.h 418B
共 923 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
- sq05022018-01-17非常好学习了
- shell_tao2017-10-10非常好,学习了
- erduniuren2019-01-07资源还不错
朝霞弱碱
- 粉丝: 16
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功