MLDownloadImageView 1.2

MLDownloadImageView 1.2

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年8月

Marcos Lacerda 维护。



  • Marcos Lacerda

用于 iOS 下载图片的组件。

功能

  • 从 URL 下载图片
  • 圆角
  • 错误占位符
  • 下载进度
  • 缓存图片

要求

N/A

将 MLDownloadImageView 添加到您的项目中

源文件

另一种方法是将 MLDownloadImageView.hMLDownloadImageView.m 源文件直接添加到您的项目中。

  1. 下载最新的代码版本 master.zip,或将存储库作为 git 子模块添加到您的 git 跟踪项目中。
  2. 在 Xcode 中打开您的项目,然后拖放 MLDownloadImageView.hMLDownloadImageView.m 到您的项目(使用“产品导航视图”)。确保在问到时选择“复制项目”。
  3. 使用 #import "MLDownloadImageView.h" 在您需要的任何地方包含 MLDownloadImageView。

用法

要使用 MLDownloadImageView,请简单创建一个对象,并按以下示例调用方法

MLDownloadImageView *imageView = [[MLDownloadImageView alloc] initWithFrame:CGRectMake(0, 0, 204, 204)];

[self.view addSubview:imageView];

// Configure MLDownloadImageView
NSString *yourURL = @""; // Url download image here
NSURL *urlToDownload = [[NSURL alloc] initWithString:yourURL];

// Place Holders (Is not required)
UIImage *placeHolder = [UIImage imageNamed:@"yourPlaceHolder"];
UIImage *imageError = [UIImage imageNamed:@"yourImageError"];

// Optional settings
BOOL isRounded = NO;
BOOL cacheEnable = YES;

[imageView downloadImageWithURL:urlToDownload placeHolder:placeHolder imageError:imageError roundedCorners:isRounded];

imageView.progressColor = [UIColor blackColor];
imageView.cacheEnable = cacheEnable;

// Start download
[imageView startDownload];

许可证

本项目使用 MIT 许可证。