I have a paging UICollectionView
that scrolls through images. Each image fills the screen. For regular photos, my collectionView
scrolls fluently but with panoramic shots, it begins to lag as I scroll through the images.
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
imageCell *cell = (imageCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
cell.tag = indexPath.row;
PFObject *temp = [_dataArray objectAtIndex:indexPath.row];
PFUser *user = [temp objectForKey:@"user"];
PFFile *file = [temp objectForKey:@"image"];
[file getDataInBackgroundWithBlock:^(NSData *data, NSError *error){
if (!error) {
cell.selectedImageView.image = [UIImage imageWithData:data];
self.navigationItem.title = [user objectForKey:@"Name"];
}
}];
return cell;
}
As you can see I load the image in the background.
Is it possible I need to do something in willDisplayCell
?. Thanks