有时候需要知道图片的宽高去设置相应的位置,SDWebImage里面的方法就可以直接得到:
[[SDWebImageDownloader sharedDownloader]downloadImageWithURL:[NSURL URLWithString:urlString] options:SDWebImageDownloaderUseNSURLCache progress:^(NSInteger receivedSize, NSInteger expectedSize) {
} completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
//这边就能拿到图片了
_width = image.width;
_height = image.height;
}];