forum

Home / DeveloperSection / Forums / Scrolling problem using UICollectionView in Xcode?

Scrolling problem using UICollectionView in Xcode?

Anonymous User 1888 28-Jan-2016

I have created an image gallery application using UICollectionView in iPhone. My collection view cell are approximately (65, 65) size. For our image gallery I am getting images using ALAssets from the ALAssetLibrary and storing them in a list(NSMutableArray). 

This is my code:

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *identifier = @"MyCell";
  UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
  UIView *parentView = [[UIView alloc] initWithFrame:CGRectMake(0,0, cell.frame.size.width, cell.frame.size.height)];
  UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,50,50)];
  imageView.image = [imageAssetList objectAtIndex:indexpath.row];
  [parentView addSubview:imageView];
  [cell addSubview:parentView];
  return mycell;
}

Now, my application running perfectly but whenever I will scroll image continuously I have getting scrolling problem, it will not scroll freely.
I google it but I don't get any perfect solution for that.
Please help me, how can I solve this problem.


Updated on 04-Feb-2016
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By