I want to use multiple identifiers in UICollectionViewCell.
But it seems like I can set just one reuse identifier for CollectionView.
[collectionView registerClass:[CollectionViewCell class] forCellWithReuseIdentifier:@"CollectionViewCell"];
It really worked with just one identifier, but when I use the different identifier like this, it gives the error message.
CollectionViewCell *cell = (CollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"NewID" forIndexPath:indexPath];
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier CollectionViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
How can I set multiple identifiers in UICollectionViewCell?
I want to display multiple custom cells simultaneously.
Each cell has UIScrollView and UIPageControl.
Unless I can set different identifiers, the instance will be reused to the new cell and the UIPageControl are not reacted by the movement in the each UIScrollView.
You must call
registerClass:forCellWithReuseIdentifier:
for each class and cell you wish to use.If you want to use cells with different reuse identifiers, you must create different classes for them and then register those classes with the collection view for that reuse identifier.
Now, you can use a cell with any of those three identifiers.