Note that there are some explanatory texts on larger screens.

plurals
  1. POuicollection view reusable cell images are reloading while scrolling
    primarykey
    data
    text
    <p>hello am using UICollectionView for showing images in my iphone application but when i scrolling the view the loaded images are gone and loading images again this is because of "dequeueReusableCellWithReuseIdentifier" and this is my code </p> <pre><code>static NSString * const kCellReuseIdentifier = @"collectionViewCell"; [self.collectionViewPack registerNib:[UINib nibWithNibName:@"CollectionViewItem" bundle:nil] forCellWithReuseIdentifier:kCellReuseIdentifier]; - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCellReuseIdentifier forIndexPath:indexPath]; cell.layer.shouldRasterize = YES; cell.layer.rasterizationScale = [UIScreen mainScreen].scale; UILabel *titleLabel = (UILabel *)[cell viewWithTag:100]; UIImageView *icon=(UIImageView *)[cell viewWithTag:101]; // [titleLabel setText:[NSString stringWithFormat:@"%d",indexPath.row]]; [titleLabel setText:[NSString stringWithFormat:@"%@",[arrayImages objectAtIndex:indexPath.row]]]; icon.image =[UIImage imageNamed:@"loading-1.png"]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSString *imagePath = [NSString stringWithFormat:@"%@", [test.arrImages objectAtIndex:indexPath.row]]; NSURL *imageUrl = [NSURL URLWithString:imagePath]; NSData *imageData = [NSData dataWithContentsOfURL:imageUrl]; UIImage *image = nil; if (imageData){ image = [[UIImage alloc] initWithData:imageData]; icon.image = image; } [image release]; }); return cell; } </code></pre> <p>please help me out from this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload