如何下载uiimage async
在使用AFNetworking 2.0的ios中,我怎样才能轻松地异步下载远程映像并将其缓存以用于将来请求相同的url? 我正在寻找一种方便的方式来接收错误回调和成功的回调。
谢谢
你可以做
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
requestOperation.responseSerializer = [AFImageResponseSerializer serializer];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"Response: %@", responseObject);
_imageView.image = responseObject;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Image error: %@", error);
}];
[requestOperation start];
还提到如何使用AFNetworking 2.0下载图像?
链接地址: http://www.djcxy.com/p/96765.html