nzfadeimageview_GitHub - shimminZ/YYWebImage: Asynchronous image loading framework.

YYWebImage是一个高效、强大的异步图片加载框架,用于替换SDWebImage和FLAnimatedImage,支持WebP、APNG、GIF动画,提供内存和磁盘缓存,具有渐进式加载、图片处理等功能。
摘要由CSDN通过智能技术生成

YYWebImage

YYWebImage is an asynchronous image loading framework (a component of YYKit).

It was created as an improved replacement for SDWebImage, PINRemoteImage and FLAnimatedImage.

It use YYCache to support memory and disk cache, and YYImage to support WebP/APNG/GIF image decode.

See these project for more information.

Features

Asynchronous image load from remote or local URL.

Animated WebP, APNG, GIF support (dynamic buffer, lower memory usage).

Baseline/progressive/interlaced image decode support.

Image loading category for UIImageView, UIButton, MKAnnotationView and CALayer.

Image effect: blur, round corner, resize, color tint, crop, rotate and more.

High performance memory and disk image cache.

High performance image loader to avoid main thread blocked.

Fully documented.

Usage

###Load image from URL

// load from remote url

imageView.yy_imageURL = [NSURL URLWithString:@"http://github.com/logo.png"];

// load from local url

imageView.yy_imageURL = [NSURL fileURLWithPath:@"/tmp/logo.png"];

###Load animated image

// just replace `UIImageView` with `YYAnimatedImageView`

UIImageView *imageView = [YYAnimatedImageView new];

imageView.yy_imageURL = [NSURL URLWithString:@"http://github.com/ani.webp"];

###Load image progressively

// progressive

[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressive];

// progressive with blur and fade animation (see the demo at the top of this page)

[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];

###Load and process image

// 1. download image from remote

// 2. get download progress

// 3. resize image and add round corner

// 4. set image with a fade animation

[imageView yy_setImageWithURL:url

placeholder:nil

options:YYWebImageOptionSetImageWithFadeAnimation

progress:^(NSInteger receivedSize, NSInteger expectedSize) {

progress = (float)receivedSize / expectedSize;

}

transform:^UIImage *(UIImage *image, NSURL *url) {

image = [image yy_imageByResizeToSize:CGSizeMake(100, 100) contentMode:UIViewContentModeCenter];

return [image yy_imageByRoundCornerRadius:10];

}

completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error) {

if (from == YYWebImageFromDiskCache) {

NSLog(@"load from disk cache");

}

}];

###Image Cache

YYImageCache *cache = [YYWebImageManager sharedManager].cache;

// get cache capacity

cache.memoryCache.totalCost;

cache.memoryCache.totalCount;

cache.diskCache.totalCost;

cache.diskCache.totalCount;

// clear cache

[cache.memoryCache removeAllObjects];

[cache.diskCache removeAllObjects];

// clear disk cache with progress

[cache.diskCache removeAllObjectsWithProgressBlock:^(int removedCount, int totalCount) {

// progress

} endBlock:^(BOOL error) {

// end

}];

Installation

CocoaPods

Update cocoapods to the latest version.

Add pod 'YYWebImage' to your Podfile.

Run pod install or pod update.

Import .

Notice: it doesn't include WebP subspec by default, if you want to support WebP format, you may add pod 'YYImage/WebP' to your Podfile. You may call YYImageWebPAvailable() to check whether the WebP subspec is installed correctly.

Carthage

Add github "ibireme/YYWebImage" to your Cartfile.

Run carthage update --platform ios and add the framework to your project.

Import .

Notice: carthage framework doesn't include webp component, if you want to support WebP format, use CocoaPods or install manually. You may call YYImageWebPAvailable() to check whether the WebP library is installed correctly.

Manually

Download all the files in the YYWebImage subdirectory.

Add the source files to your Xcode project.

Link with required frameworks:

UIKit

CoreFoundation

QuartzCore

AssetsLibrary

ImageIO

Accelerate

MobileCoreServices

sqlite3

libz

Import YYWebImage.h.

Notice: if you want to support WebP format, you may add Vendor/WebP.framework(static library) to your Xcode project.

Documentation

Full API documentation is available on CocoaDocs.

You can also install documentation locally using appledoc.

Requirements

This library requires iOS 6.0+ and Xcode 7.0+.

License

YYWebImage is provided under the MIT license. See LICENSE file for details.

中文介绍

YYWebImage 是一个异步图片加载框架 (YYKit 组件之一).

其设计目的是试图替代 SDWebImage、PINRemoteImage、FLAnimatedImage 等开源框架,它支持这些开源框架的大部分功能,同时增加了大量新特性、并且有不小的性能提升。

它底层用 YYCache 实现了内存和磁盘缓存, 用 YYImage 实现了 WebP/APNG/GIF 动图的解码和播放。

你可以查看这些项目以获得更多信息。

特性

异步的图片加载,支持 HTTP 和本地文件。

支持 GIF、APNG、WebP 动画(动态缓存,低内存占用)。

支持逐行扫描、隔行扫描、渐进式图像加载。

UIImageView、UIButton、MKAnnotationView、CALayer 的 Category 方法支持。

常见图片处理:模糊、圆角、大小调整、裁切、旋转、色调等。

高性能的内存和磁盘缓存。

高性能的图片设置方式,以避免主线程阻塞。

每个类和方法都有完善的文档注释。

用法

###从 URL 加载图片

// 加载网络图片

imageView.yy_imageURL = [NSURL URLWithString:@"http://github.com/logo.png"];

// 加载本地图片

imageView.yy_imageURL = [NSURL fileURLWithPath:@"/tmp/logo.png"];

###加载动图

// 只需要把 `UIImageView` 替换为 `YYAnimatedImageView` 即可。

UIImageView *imageView = [YYAnimatedImageView new];

imageView.yy_imageURL = [NSURL URLWithString:@"http://github.com/ani.webp"];

###渐进式图片加载

// 渐进式:边下载边显示

[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressive];

// 渐进式加载,增加模糊效果和渐变动画 (见本页最上方的GIF演示)

[imageView yy_setImageWithURL:url options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];

###加载、处理图片

// 1. 下载图片

// 2. 获得图片下载进度

// 3. 调整图片大小、加圆角

// 4. 显示图片时增加一个淡入动画,以获得更好的用户体验

[imageView yy_setImageWithURL:url

placeholder:nil

options:YYWebImageOptionSetImageWithFadeAnimation

progress:^(NSInteger receivedSize, NSInteger expectedSize) {

progress = (float)receivedSize / expectedSize;

}

transform:^UIImage *(UIImage *image, NSURL *url) {

image = [image yy_imageByResizeToSize:CGSizeMake(100, 100) contentMode:UIViewContentModeCenter];

return [image yy_imageByRoundCornerRadius:10];

}

completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error) {

if (from == YYWebImageFromDiskCache) {

NSLog(@"load from disk cache");

}

}];

###图片缓存

YYImageCache *cache = [YYWebImageManager sharedManager].cache;

// 获取缓存大小

cache.memoryCache.totalCost;

cache.memoryCache.totalCount;

cache.diskCache.totalCost;

cache.diskCache.totalCount;

// 清空缓存

[cache.memoryCache removeAllObjects];

[cache.diskCache removeAllObjects];

// 清空磁盘缓存,带进度回调

[cache.diskCache removeAllObjectsWithProgressBlock:^(int removedCount, int totalCount) {

// progress

} endBlock:^(BOOL error) {

// end

}];

安装

CocoaPods

将 cocoapods 更新至最新版本.

在 Podfile 中添加 pod 'YYWebImage'。

执行 pod install 或 pod update。

导入 。

注意:pod 配置并没有包含 WebP 组件, 如果你需要支持 WebP,可以在 Podfile 中添加 pod 'YYImage/WebP'。你可以调用 YYImageWebPAvailable() 来检查一下 WebP 组件是否被正确安装。

Carthage

在 Cartfile 中添加 github "ibireme/YYWebImage"。

执行 carthage update --platform ios 并将生成的 framework 添加到你的工程。

导入 。

注意: carthage framework 并没有包含 webp 组件。如果你需要支持 WebP,可以用 CocoaPods 安装,或者手动安装。

手动安装

下载 YYWebImage 文件夹内的所有内容。

将 YYWebImage 内的源文件添加(拖放)到你的工程。

链接以下 frameworks:

UIKit

CoreFoundation

QuartzCore

AssetsLibrary

ImageIO

Accelerate

MobileCoreServices

sqlite3

libz

导入 YYWebImage.h。

注意:如果你需要支持 WebP,可以将 Vendor/WebP.framework(静态库) 加入你的工程。你可以调用 YYImageWebPAvailable() 来检查一下 WebP 组件是否被正确安装。

文档

你可以在 CocoaDocs 查看在线 API 文档,也可以用 appledoc 本地生成文档。

系统要求

该项目最低支持 iOS 6.0 和 Xcode 7.0。

许可证

YYWebImage 使用 MIT 许可证,详情见 LICENSE 文件。

相关链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用\[1\]和引用\[2\]的信息,您在从GitHub上克隆资源时遇到了无法访问主机的错误。这可能是由于网络连接问题导致的。您可以尝试以下解决方法: 1. 检查您的网络连接是否正常。确保您可以访问其他网站,并且没有任何网络问题。 2. 如果您使用了代理,请按照引用\[3\]中提供的步骤设置Git Bash中的代理。确保代理地址和端口正确,并且代理设置生效。 3. 如果您没有使用代理,或者代理设置没有解决问题,您可以尝试使用Git的SSH协议进行克隆。首先,您需要在GitHub上设置SSH密钥。然后,使用SSH URL进行克隆,例如:git clone git@github.com:ros-planning/geometric_shapes.git。 4. 如果上述方法都没有解决问题,可能是由于GitHub服务器出现问题或其他临时问题导致的。您可以稍后再次尝试克隆,或者尝试使用其他网络环境进行克隆。 希望以上解决方法能够帮助您解决问题。如果问题仍然存在,请提供更多详细信息,以便我们能够更好地帮助您。 #### 引用[.reference_title] - *1* [解决Github:fatal:unable to access ‘https://github.com/.../.git‘:Could not resolve host:github.com](https://blog.csdn.net/weixin_44296929/article/details/111242452)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [fatal: 无法访问 https://github.com/ :Failed to connect to github.com port 443: 拒绝连接的解决办法](https://blog.csdn.net/weixin_59168010/article/details/124768747)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [关于git:fatal:无法访问’https://github.com/xxx’:OpenSSL SSL_connect:SSL_ERROR_SYSCALL连接到...](https://blog.csdn.net/qq_37124515/article/details/114190310)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值