Saran
Saran

Reputation: 6392

UICollectionView dequeueReusableCellWithReuseIdentifier causing performance issue

I am just beginning to use collection view. It's an empty collection view cell haven't added anything yet. I just thought to see how it looks first, later would be adding more UI elements.

But noticing scrolling is not smooth. It takes a moment before starts scrolling. Once started scrolling it runs well till scroll ends. But again it happens when it has to start scrolling.

Running on instruments tells that deque takes time.

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseCellIdentifier forIndexPath:indexPath];

My complete cellForItemAtIndexPath is as given below:

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{

 static NSString *reuseCellIdentifier = @"Reuse";

UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseCellIdentifier forIndexPath:indexPath];
//cell.backgroundColor = [UIColor whiteColor];
//cell.layer.shouldRasterize = YES;
//cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
return cell;
}

Commented lines has no effect when uncommented.

Is there anything i can do to improve the performance? My environment is iOS 7 simulator.

Upvotes: 0

Views: 1500

Answers (1)

peko
peko

Reputation: 11335

Don't worry, iOS7 simulator doesn't perform really well, on a device there shouldn't be any performance issues.

Upvotes: 1

Related Questions