I have to load many images into UICollectionView
. When i scroll the UICollectionView
, I feel it got a little bit of lag when I scroll to next page. Is it because I loaded 12 images when it go next page? If yes, how can I solve it. Below is my code.
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"TestAZCollectionViewCell";
TestAZCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
imgPath = [imgDir stringByAppendingPathComponent:[[itemArray objectAtIndex:indexPath.row]objectForKey:@"IM_ImgName"]];
cell.cellImage.image = [UIImage imageWithContentsOfFile:imgPath];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"no_image.jpg"]];
return cell;
}
anyone can help on this ?