vendredi 14 août 2015

Async Image Loading Performance

I am loading images in UITableViewCell receiving from url using below code, everything is working fine but the image load very slow in UITableViewCell and if i think as a user, it is not acceptable.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [checkData count];
}    

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSInteger i =indexPath.row;
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
UIImageView propertyImage = (UIImageView *)[cell viewWithTag:10];
 NSString *test = [[checkData objectAtIndex:i]valueForKey:@"image"];
    CGRect frame=propertyImage.bounds;
    AsyncImageView asyImage=[[AsyncImageView alloc] initWithFrame:frame];
    [asyImage setImage:[UIImage imageNamed:@"loading.png"]];
    self.urlForTesting=[NSURL URLWithString:test];
    [asyImage loadImageFromURL:self.urlForTesting];
    asyImage.imageURL =self.urlForTesting;
    asyImage.contentMode = UIViewContentModeScaleToFill;
    asyImage.layer.masksToBounds=YES;
    [propertyImage addSubview:asyImage];
    return cell;
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire