i am parsing json from SBJson parser and showing it in table view successfully.I am using SDWebImage to cache images for offline support by using
UIImageView *thumbImg = [[UIImageView alloc] initWithFrame:CGRectMake(5, 3, 50, 50)];
thumbImg.tag = 1;
thumbImg.contentMode = UIViewContentModeScaleAspectFill;
thumbImg.layer.cornerRadius = 10;
thumbImg.layer.masksToBounds = YES;
thumbImg.layer.borderColor = [UIColor lightGrayColor].CGColor;
thumbImg.layer.borderWidth = 1.0;
[cell.contentView addSubview:thumbImg];
[thumbImg setImageWithURL:[NSURL URLWithString:myObj.thumbnailURL]
placeholderImage:[UIImage imageNamed:@"Icon.png"]
success:^(UIImage *image) {
NSLog(@"success");
}
failure:^(NSError *error) {
NSLog(@"write error %@", error);
}];
and its showing perfectly in my 50×50 imageview. But the thumbnail images are big in size 400×600 approx. So my tableview is scrolling very slow due to large image thumbnails loading in imageview. How can i resize the image fetched by SDWebImage before caching so that next time when it load from cache it loads small size image.I have the function to resize the image but dont know where to add that code.I tried to resize by giving the image pointer which i got in success block but it had no effect.
Thanks
Here!
This library integrates SDWebImage with a Resize library
https://github.com/toptierlabs/ImageCacheResize