Skip to content

Commit

Permalink
Merge pull request #6833 from vishalduggal/timob-18765
Browse files Browse the repository at this point in the history
[TIMOB-18765] ImageView cleanup
  • Loading branch information
pec1985 committed May 11, 2015
2 parents 411dfa3 + 48ad93e commit bb1d7c0
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions iphone/Classes/TiUIImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,14 @@ -(void)loadDefaultImage:(CGSize)imageSize
}
}

-(void)loadUrl:(id)img
-(void)loadUrl:(NSURL*)img
{
[self cancelPendingImageLoads];

if (img!=nil)
{
[self removeAllImagesFromContainer];

NSURL *url_ = [TiUtils toURL:[img path] proxy:self.proxy];

// NOTE: Loading from URL means we can't pre-determine any % value.
CGSize imageSize = CGSizeMake(TiDimensionCalculateValue(width, 0.0),
TiDimensionCalculateValue(height,0.0));
Expand All @@ -497,8 +495,8 @@ -(void)loadUrl:(id)img

// Skip the imageloader completely if this is obviously a file we can load off the fileystem.
// why were we ever doing that in the first place...?
if ([url_ isFileURL]) {
UIImage* image = [UIImage imageWithContentsOfFile:[url_ path]];
if ([img isFileURL]) {
UIImage* image = [UIImage imageWithContentsOfFile:[img path]];
if (image != nil) {
UIImage *imageToUse = [self rotatedImage:image];
autoWidth = imageToUse.size.width;
Expand All @@ -513,19 +511,19 @@ -(void)loadUrl:(id)img
}


UIImage *image = [[ImageLoader sharedLoader] loadImmediateImage:url_];
UIImage *image = [[ImageLoader sharedLoader] loadImmediateImage:img];
if (image==nil)
{
[self loadDefaultImage:imageSize];
placeholderLoading = YES;
[(TiUIImageViewProxy *)[self proxy] startImageLoad:url_];
[(TiUIImageViewProxy *)[self proxy] startImageLoad:img];
return;
}

if (image!=nil)
{
UIImage *imageToUse = [self rotatedImage:image];
[(TiUIImageViewProxy*)[self proxy] setImageURL:url_];
[(TiUIImageViewProxy*)[self proxy] setImageURL:img];

autoWidth = imageToUse.size.width;
autoHeight = imageToUse.size.height;
Expand Down Expand Up @@ -679,10 +677,7 @@ -(void)setImage_:(id)arg
return;
}

BOOL replaceProperty = YES;
UIImage *image = nil;
NSURL* imageURL = nil;
image = [self convertToUIImage:arg];
UIImage *image = [self convertToUIImage:arg];

if (image == nil)
{
Expand Down

0 comments on commit bb1d7c0

Please sign in to comment.