Beginning Collection Views | Ray Wenderlich

Learn all about using collection views in iOS, starting with the basics, such as setting up a collection view in Interface Builder, and then move right through to some more advanced topics, like creating and manipulating custom cells and layouts.

This is a companion discussion topic for the original entry at

I found there is a weird problem in the editing mode when the app with multiple sections. If I selected the first item of the first section(Denali National Park), then scrolling the collectionView downward and back to the original position, the other items (Katmai National Park/ Kenai Fjords National Park) would be shown selected status but cannot be deselected.

Can you help explain this issue and solve it? Thanks!

Without knowing the code that you added, I can’t diagnose what you might have mistyped. My suggestion is to download the sample projects and compare the version from your files to the actual sample project files.

The app I tested is the original sample projects. Please reconfirm that.

Would you let me know which video you are referencing? Once I know, I’ll give it a test and let your know what I find.

Please refer to the download materials within the videos from 16 to 20. I found they all have the same problem.

Okay, I’ve reviewed the project and the issue is stemming from the recycling of cells. The cells are being recycled so parks will randomly appear selected. You’ll have to track the state of the selection in a model object. I make a note of it to fix for our next update.

Thanks for letting me know.

Thank you for your reply and I am looking forward to your next update.

Hello and thank you for a great tutorial!

It seems as if the Final Project is not the actual final project. Curious if there was a final code repository to glance over? I’m having a little bit of trouble with my stack view and CollectionViewCell and I’m wondering if I missed something in the video.


Thanks for the heads up. I’ve made sure to update the final projects.

Thanks! I just built and ran the Final repo and it crashes while opening. I believe this is the error message: ***** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<CollectionView.CollectionViewCell 0x7fafcd539f40> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key mainImage.'** *******

Interesting - I’ll take a look and see what’s going on.

I’ve tried both the starter and final projects for the last episode, and both run fine. It sounds like a IBOutlet may have been removed. If you have any more information, please feel free to send it my way and I’ll take a look.