I have a collection view in my project with lots of data coming from a web service. When I scroll the collection view vertically, it doesn't scroll smoothly.
I used SDWebImage
to load the images asynchronously.
Here is the code of cellForItemAtIndexPath
:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CategoryListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CategoryListCell" forIndexPath:indexPath];
cell.movName.text = [nameArray objectAtIndex:indexPath.item];
num = [[numArray objectAtIndex:indexPath.item]integerValue];
cell.itemNo.text = [NSString stringWithFormat:@"%ld", (long)num];
[cell.movImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",[imageArray objectAtIndex:indexPath.item]]] placeholderImage:[UIImage imageNamed:@"Main_Logo.png"]];
[cell.movImage setShowActivityIndicatorView:YES];
[cell.movImage setIndicatorStyle:UIActivityIndicatorViewStyleWhite];
return cell;
}
When I run the project on Simulator it scrolls smoothly but when run it on Physical Device it does not scroll smoothly. How can I solve this?