rs/SDWebImage — Issue #55: i have created an PNG image with a transparent background and use this as a placeholder image.its shows Dark background on images in default UITableViewCell. Dont know what is the issue   i have change the code in UIImageView+WebCache.h for having activit
Author: pradeeptjha
Created: 2011-12-26 13:22:26+00:00
State: open

i have created an PNG image with a transparent background and use this as a placeholder image.its shows Dark background on images in default UITableViewCell. Dont know what is the issue i have change the code in UIImageView+WebCache.h for having activity indicator

==========================================================================================

#import "UIImageView+WebCache.h"

#define kCustomRowHeight 80.0
#define kAppIconHeight 50
#define kCustomRowHeightipad 80.0
#define kAppIconHeightipad 120

@implementation UIImageView (WebCache)

- (void)setImageWithURL:(NSURL *)url
{
[self setImageWithURL:url placeholderImage:nil];
}

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder
{
[self setImageWithURL:url placeholderImage:placeholder options:0];
}

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options
{
SDWebImageManager *manager = [SDWebImageManager sharedManager];

// Remove in progress downloader from queue
[manager cancelForDelegate:self];

self.image = placeholder;
self.alpha = 1;

UIActivityIndicatorView *activityIndicator = (UIActivityIndicatorView*)[self viewWithTag:1001];

if (activityIndicator == nil) {

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

activityIndicator.tag = 1001;

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
activityIndicator.frame=CGRectMake(0, 0, 70, 70);
activityIndicator.center = CGPointMake(42.0f,50.0f);
}
else{
activityIndicator.center = CGPointMake(21.5f,21.5f);
}
[self addSubview:activityIndicator];

[activityIndicator startAnimating];
}

else {

[activityIndicator startAnimating];
}

if (url)
{
[manager downloadWithURL:url delegate:self options:options];
}
}

- (void)cancelCurrentImageLoad
{
UIView *activityIndicator = [self viewWithTag:1001];
[activityIndicator removeFromSuperview];
[[SDWebImageManager sharedManager] cancelForDelegate:self];
}

- (void)webImageManager:(SDWebImageManager *)imageManager didFinishWithImage:(UIImage *)image
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

CGSize itemSize = CGSizeMake(kAppIconHeightipad, kAppIconHeightipad);
UIGraphicsBeginImageContextWithOptions(itemSize, YES, 0);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[image drawInRect:imageRect];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.image=newImage;

}
else
{
CGSize itemSize = CGSizeMake(kAppIconHeight, kAppIconHeight);
UIGraphicsBeginImageContextWithOptions(itemSize, YES, 0);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[image drawInRect:imageRect];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.image=newImage;

}
UIView *activityIndicator = [self viewWithTag:1001];
[activityIndicator removeFromSuperview];
}

@end
=============================================================================================

SEE THE IMAGE U WILL GET IT

http://www.filejumbo.com/Download/8604C4259887534B

I WANT IMAGE

http://www.filejumbo.com/Download/9F12F348B6D52C3A

Thanks in Advance
Pradeeo Jha