Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EGOImageView imageView.imageURL performance #26

Open
manoelfranklin opened this issue Jun 8, 2012 · 15 comments
Open

EGOImageView imageView.imageURL performance #26

manoelfranklin opened this issue Jun 8, 2012 · 15 comments

Comments

@manoelfranklin
Copy link

Hi all,

I'm noticing that using the imageView.imageURL of EGOImageView is downloading images too slow.

The images are available on CDN Akamai (Cloud Files from Rackspace Cloud) and even in Wifi, the download is too slow.

How I'm implementing:

  • (void)awakeFromNib {

    [super awakeFromNib];

    imageView = [[EGOImageView alloc] initWithPlaceholderImage:[UIImage imageNamed:@"placeholder.png"]];
    imageView.frame = CGRectMake(50, 36, 268, 205);
    [self.contentView addSubview:imageView];

}

And after this:

imageView.imageURL = [NSURL URLWithString:url];

My images have on average 300kb and are taking almost a minute to load on wifi.

Is there anything wrong on my implementation? Any suggestions?

Thank you in advance!

@manoelfranklin
Copy link
Author

Also... I'm not using [imageView cancelImageLoad];

I tried to implement in two ways:

  • (void)willMoveToSuperview:(UIView *)newSuperview {

    [super willMoveToSuperview:newSuperview];

    if(!newSuperview) {
    [imageView cancelImageLoad];
    [imageViewPerfil cancelImageLoad];
    }
    }

  • (void)removeFromSuperview {

    [super removeFromSuperview];
    [imageView cancelImageLoad];
    [imageViewPerfil cancelImageLoad];

    }

but both keep crashing the app! Any suggestions?? THanks

@xissburg
Copy link

xissburg commented Jun 8, 2012

I suggest you use SDWebImage.

@manoelfranklin
Copy link
Author

@xissburg downloaded, implemented and testing... the cache seems better, the uitableview is scrolling smotth, but the images are still taking so long to load... I mean, I scroll the table view and the placeholder keep showing for almost one minute ... and the activity indicator on the right of the carrier name stops, vanishes, is not there anymore... The images have only 300kb! ANy ideas?

@xissburg
Copy link

xissburg commented Jun 8, 2012

Do they also take a long time to load in other apps such as in the browser?

@manoelfranklin
Copy link
Author

My main concern is that, after loading the placeholder image, the network activity indicator at the right of the Carrier name disappear and images take too long to load! Any sugestions?

@manoelfranklin
Copy link
Author

@xissburg no, really quick on the browser!

@manoelfranklin
Copy link
Author

@xissburg and than, sometimes they load all in once, at the same time!

@xissburg
Copy link

xissburg commented Jun 8, 2012

Do they load while you're scrolling? I mean, keep scrolling up/down (don't remove your finger from the screen) and check whether they load while you're doing that.

@manoelfranklin
Copy link
Author

@xissburg no, they do not load while scrolling... but its really strange... the network activity indicator disappears... the placeholders stay there for a long long time and images do not load!! or load REALLY slow, after a long time

@xissburg
Copy link

xissburg commented Jun 8, 2012

Show code.

@manoelfranklin
Copy link
Author

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    // Nome / Identificador da Celula para Reunitilizar Celulas.
    static NSString *CellIdentifier = @"BuscaAmigo";

    // Cria celula nova usando o identificador acima.
    BuscaAmigo *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if(cell == nil) {
    cell = [[[NSBundle mainBundle] loadNibNamed:@"BuscaAmigo" owner:nil options:nil] objectAtIndex:0];
    }

    NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
    dict = [buscarArray objectAtIndex:indexPath.row];

    [cell.uiivFoto setImageWithURL:[NSURL URLWithString:[dict objectForKey:@"fotoUsuario"]]
    placeholderImage:[UIImage imageNamed:@"no_user.png"]];
    cell.IdUsuario = [dict objectForKey:@"idUsuario"];
    cell.uilNome.text = [dict objectForKey:@"nomeUsuario"];
    cell.uilEmail.text = [dict objectForKey:@"emailUsuario"];
    cell.seguindo = [dict objectForKey:@"seguindo"];

    dict = nil;

    return cell;

}

@manoelfranklin
Copy link
Author

I'm using this in a lot of tableviews, really a lot... to load users, photos, etc... Always the same thing:

[cell.uiivFoto setImageWithURL:[NSURL URLWithString:[dict objectForKey:@"fotoUsuario"]]
placeholderImage:[UIImage imageNamed:@"no_user.png"]];

I have now, in front of me, a tableview with 20 rows,... 3 loaded images and no images are loading anymore!

@manoelfranklin
Copy link
Author

Every row have images, only 3 loaded, the other 17 are placeholders until now

@xissburg
Copy link

xissburg commented Jun 8, 2012

That is kinda weird. Try debugging it, set a breakpoint and step into SDWebImage. You should open an issue on the SDWebImage project anyway.

@manoelfranklin
Copy link
Author

@xissburg doing more tests here, it seems that when the cell appears on the screen, the image loading is triggered but the image after loaded do not draw on the cell... When the cell go out of the screen and come back, it seems that the cell get the image from the cache and show it correctly... Is there anything I have to turn on to auto redraw the cell after the image is loaded or something like this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants