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.
Tarun Kumar
04-Feb-2016for perfect result use above code under this code:
I hope it will also solve your problem because this was helpful for me.