* SDWebImageRetryFailed = 1<< 0, 默认选项,失败后重试
* SDWebImageLowPriority = 1<< 1, 使用低优先级
* SDWebImageCacheMemoryOnly = 1<< 2, 仅仅使用内存缓存
* SDWebImageProgressiveDownload = 1<< 3, 显示现在进度
* SDWebImageRefreshCached = 1<< 4, 刷新缓存
* SDWebImageContinueInBackground =1 << 5, 后台继续下载图像
* SDWebImageHandleCookies = 1<< 6, 处理 Cookie
* SDWebImageAllowInvalidSSLCertificates= 1 << 7, 允许无效的 SSL 验证
* SDWebImageHighPriority = 1<< 8, 高优先级
* SDWebImageDelayPlaceholder = 1<< 9 延迟显示占位图片
//
// ZBMainViewController.m
// SDWebImageDemo
//
// Created by 张先森 on 14/11/27.
// Copyright (c) 2014年 zhibin. All rights reserved.
//
#import "ZBMainViewController.h"
#import "UIImageView+WebCache.h"
@interface ZBMainViewController ()
@end
@implementation ZBMainViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UIImageView *imageview=[[UIImageView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:imageview];
NSURL *url=[NSURL URLWithString:@"http://img.xmfish.com/attachment/Mon_1411/6_1298069_060594db2f0cdcc.jpg"];
[imageview setImageWithURL:url placeholderImage:[UIImage imageNamed:@"tabbar_profile_selected_os7"] options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize) {
NSLog(@"%.2f",(float)receivedSize/(float)expectedSize);
} completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
}];
}
@end