# SVProgressHUD
![Pod Version](https://img.shields.io/cocoapods/v/SVProgressHUD.svg?style=flat)
![Pod Platform](https://img.shields.io/cocoapods/p/SVProgressHUD.svg?style=flat)
![Pod License](https://img.shields.io/cocoapods/l/SVProgressHUD.svg?style=flat)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
`SVProgressHUD` is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS.
![SVProgressHUD](http://f.cl.ly/items/2G1F1Z0M0k0h2U3V1p39/SVProgressHUD.gif)
## Demo
Try `SVProgressHUD` on [Appetize.io](https://appetize.io/app/p8r2cvy8kq74x7q7tjqf5gyatr).
## 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. First, 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` use normal external source dependencies.
```ruby
pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
```
This pulls from the `master` branch directly.
Second, install `SVProgressHUD` into your project:
```ruby
pod install
```
### Carthage
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate `SVProgressHUD` into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
github "SVProgressHUD/SVProgressHUD"
```
Run `carthage update` to build the framework and drag the built `SVProgressHUD.framework` (in Carthage/Build/iOS folder) into your Xcode project (Linked Frameworks and Libraries in `Targets`).
### 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.
## Swift
Even though `SVProgressHUD` is written in Objective-C, it can be used in Swift with no hassle. If you use [CocoaPods](http://cocoapods.org) add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html):
```ruby
use_frameworks!
```
If you added `SVProgressHUD` manually, just add a [bridging header](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) file to your project with the `SVProgressHUD` header included.
## 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)showWithStatus:(NSString*)string;
```
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;
```
### Dismissing the HUD
The HUD can be dismissed using:
```objective-c
+ (void)dismiss;
+ (void)dismissWithDelay:(NSTimeInterval)delay;
```
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 `minimumDismissTimeInterval` and the length of the given string.
```objective-c
+ (void)showInfoWithStatus:(NSString*)string;
+ (void)showSuccessWithStatus:(NSString*)string;
+ (void)showErrorWithStatus:(NSString*)string;
+ (void)showImage:(UIImage*)image status:(NSString*)string;
```
## Customization
`SVProgressHUD` can be customized via the following methods:
```objective-c
+ (void)setDefaultStyle:(SVProgressHUDStyle)style; // default is SVProgressHUDStyleLight
+ (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType; // default is SVProgressHUDMaskTypeNone
+ (void)setDefaultAnimationType:(SVProgressHUDAnimationType)type; // default is SVProgressHUDAnimationTypeFlat
+ (void)setContainerView:(UIView*)containerView; // default is window level
+ (void)setMinimumSize:(CGSize)minimumSize; // default is CGSizeZero, can be used to avoid resizing
+ (void)setRingThickness:(CGFloat)width; // default is 2 pt
+ (void)setRingRadius:(CGFloat)radius; // default is 18 pt
+ (void)setRingNoTextRadius:(CGFloat)radius; // default is 24 pt
+ (void)setCornerRadius:(CGFloat)cornerRadius; // default is 14 pt
+ (void)setFont:(UIFont*)font; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]
+ (void)setForegroundColor:(UIColor*)color; // default is [UIColor blackColor], only used for SVProgressHUDStyleCustom
+ (void)setBackgroundColor:(UIColor*)color; // default is [UIColor whiteColor], only used for SVProgressHUDStyleCustom
+ (void)setBackgroundLayerColor:(UIColor*)color; // default is [UIColor colorWithWhite:0 alpha:0.4], only used for SVProgressHUDMaskTypeCustom
+ (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)setViewForExtension:(UIView*)view; // default is nil, only used if #define SV_APP_EXTENSIONS is set
+ (void)setMinimumDismissTimeInterval:(NSTimeInterval)interval; // default is 5.0 seconds
+ (void)setMaximumDismissTimeInterval:(NSTimeInterval)interval; // default is infinite
+ (void)setFadeInAnimationDuration:(NSTimeInterval)duration; // default is 0.15 seconds
+ (void)setFadeOutAnimationDuration:(NSTimeInterval)duration; // default is 0.15 seconds
+ (void)setMaxSupportedWindowLevel:(UIWindowLevel)windowLevel; // default is UIWindowLevelNormal
```
Additionally `SVProgressHUD` supports the `UIAppearance` protocol for most of the above methods.
### Hint
As standard `SVProgressHUD` offers two preconfigured styles:
* `SVProgressHUDStyleLight`: White background with black spinner and text
* `SVProgressHUDStyleDark`: Black background with white spinner and text
If you want to use custom colors use `setForegroundColor` and `setBackgroundColor:`. These implicity set the HUD's style to `SVProgressHUDStyleCustom`.
## 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`
没有合适的资源?快使用搜索试试~ 我知道了~
iOS高仿淘宝商品详情页上拉翻页效果,相似度99%
共97个文件
h:23个
m:20个
png:16个
需积分: 38 27 下载量 111 浏览量
2017-02-10
12:50:34
上传
评论 1
收藏 654KB ZIP 举报
温馨提示
公司需求淘宝详情翻页效果,偶然发现同事在写那个效果,自己初学iOS小白,感觉效果很神奇,就在工作休息时间在网上找了一些demo发现都是用Refresh衔接的,然后就自己随便写了一下,感觉仿的还不错,自己历来都是伸手党,很少写东西,写了也很少发表,这次鼓起勇气发布了,希望能帮助到有需要的朋友。 GitHub链接: https://github.com/cjh274180123/XHHPaging.git
资源推荐
资源详情
资源评论
收起资源包目录
XHHPaging-master.zip (97个子文件)
XHHPaging-master
.gitignore 1KB
XHHPaging
XHHPagingUITests
Info.plist 680B
XHHPagingUITests.m 1KB
Pods
Manifest.lock 229B
SVProgressHUD
LICENSE.txt 1KB
SVProgressHUD
SVIndefiniteAnimatedView.m 5KB
SVProgressAnimatedView.h 445B
SVProgressHUD.h 10KB
SVProgressHUD.m 55KB
SVProgressHUD.bundle
angle-mask@3x.png 8KB
info@2x.png 816B
angle-mask@2x.png 5KB
error@3x.png 398B
info@3x.png 1KB
success@3x.png 714B
error@2x.png 306B
success@2x.png 462B
info.png 365B
angle-mask.png 2KB
error.png 184B
success.png 262B
SVRadialGradientLayer.h 303B
SVIndefiniteAnimatedView.h 407B
SVRadialGradientLayer.m 909B
SVProgressAnimatedView.m 3KB
README.md 10KB
Target Support Files
Pods-XHHPagingTests
Pods-XHHPagingTests.debug.xcconfig 548B
Pods-XHHPagingTests-acknowledgements.markdown 133B
Pods-XHHPagingTests-acknowledgements.plist 805B
Pods-XHHPagingTests-resources.sh 5KB
Pods-XHHPagingTests-frameworks.sh 3KB
Pods-XHHPagingTests.release.xcconfig 548B
Pods-XHHPagingTests-dummy.m 142B
Pods-XHHPaging
Pods-XHHPaging-acknowledgements.plist 2KB
Pods-XHHPaging-frameworks.sh 3KB
Pods-XHHPaging-dummy.m 132B
Pods-XHHPaging.debug.xcconfig 590B
Pods-XHHPaging.release.xcconfig 590B
Pods-XHHPaging-acknowledgements.markdown 1KB
Pods-XHHPaging-resources.sh 5KB
SVProgressHUD
SVProgressHUD-prefix.pch 48B
SVProgressHUD-dummy.m 130B
SVProgressHUD.xcconfig 574B
Pods-XHHPagingUITests
Pods-XHHPagingUITests-frameworks.sh 3KB
Pods-XHHPagingUITests-acknowledgements.markdown 133B
Pods-XHHPagingUITests.debug.xcconfig 548B
Pods-XHHPagingUITests.release.xcconfig 548B
Pods-XHHPagingUITests-dummy.m 146B
Pods-XHHPagingUITests-acknowledgements.plist 805B
Pods-XHHPagingUITests-resources.sh 5KB
Headers
Public
SVProgressHUD
SVProgressAnimatedView.h 61B
SVProgressHUD.h 52B
SVRadialGradientLayer.h 60B
SVIndefiniteAnimatedView.h 63B
Private
SVProgressHUD
SVProgressAnimatedView.h 61B
SVProgressHUD.h 52B
SVRadialGradientLayer.h 60B
SVIndefiniteAnimatedView.h 63B
Pods.xcodeproj
project.pbxproj 50KB
Podfile.lock 229B
XHHPaging.xcodeproj
project.xcworkspace
contents.xcworkspacedata 154B
project.pbxproj 37KB
XHHPagingTests
Info.plist 680B
XHHPagingTests.m 895B
1.png 23KB
2.png 276KB
podfile 453B
XHHPaging.xcworkspace
contents.xcworkspacedata 227B
XHHPaging
ViewController.m 5KB
Info.plist 1KB
main.m 324B
MJRefresh
MJRefresh.bundle
jiantou1.png 3KB
arrow@2x.png 3KB
MJRefreshBaseView.m 8KB
UIScrollView+MJRefresh.m 6KB
MJRefreshHeaderView.m 8KB
MJRefreshHeaderView.h 401B
MJRefreshFooterView.h 412B
UIScrollView+MJRefresh.h 3KB
MJRefreshFooterView.m 7KB
UIView+MJExtension.m 1KB
MJRefreshConst.h 1KB
UIScrollView+MJExtension.m 2KB
b21c8701a18b87d63980698b070828381e30fd60.jpg 126KB
MyDefine.h 2KB
MJRefreshBaseView.h 2KB
MJRefreshConst.m 1KB
MJRefresh.h 912B
d788d43f8794a4c288160e8d0ef41bd5ad6e395b.jpg 128KB
UIScrollView+MJExtension.h 832B
UIView+MJExtension.h 627B
Base.lproj
LaunchScreen.storyboard 2KB
Main.storyboard 2KB
ViewController.h 205B
AppDelegate.h 267B
Assets.xcassets
AppIcon.appiconset
Contents.json 585B
AppDelegate.m 2KB
共 97 条
- 1
资源评论
qq_31090455
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功