I'm loading a image into my UIImageView on my custom cells. This image is loaded using UIImageView+WebCache.h, and I want change the tintColor, but I'm trying this code but I can't change the color...
[cell.icon sd_setImageWithURL:[NSURL URLWithString:myURL
placeholderImage:[UIImage imageNamed:imageName options:SDWebImageRefreshCached];
UIImage* img = [UIImage imageNamed:imageName];
cell.icon.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
cell.icon.tintColor = [UIColor yellowColor];
How can I solve this problem?
You should be using SDWebImage
function with completion block. Try this.
cell.icon.tintColor = [UIColor yellowColor];
[cell.icon sd_setImageWithURL:[NSURL URLWithString:myURL] placeholderImage:[UIImage imageNamed:imageName] options:SDWebImageRefreshCached completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
cell.icon.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
}];