UICollectionView Tutorial: Getting Started | raywenderlich.com

Get hands-on experience with UICollectionView by creating your own grid-based photo browsing app using the Flickr API.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/18895088-uicollectionview-tutorial-getting-started

I am trying your tutorial but have some problems.

  1. UICollectionViewDelegateFlowLayout does not work. Seems storyboard override this.

  2. I have ContentView in my CollectionViewCell and i cant to delete it.

I cant make my CollectionView in 3 image in a row if i make 200 vs 200 my cell.
You project to download work but i started you starter project do all steps and its not working.

I also have a problem as the cells won´t load.
I can´t see the black test-cells nor can I open the finished flickr project.

I had the same problem: begin with the starter program and follow the tutorial, only to have the layout not appear as advertised. Run the final project, the layout is correct.

As it turns out, there is a crucial difference in the two projects. In the Main storyboard of each project, click on the Collection View Flow Layout of the Collection View Controller, and look at it in the Size inspector.

In the starter project, the Estimate Size field is set to Automatic, and in the final project, the Estimate Size field is set to None. Setting that field to None in the starter project fixes the layout.

So, following the tutorial, a Collection View Controller is added to the storyboard. The default value of the Estimate Size field in the Flow Layout object is Automatic. The tutorial needs to specify changing the Estimate Size value to None, and why this needs to happen.

2 Likes

This tutorial is a bit hard to follow for a beginner like myself. I am reading along and following the instructions, but I have no clear understanding of what I’m doing. Copying and pasting the code in FlickrPhotosViewController little by little is easy to do but hard to understand. The breakdown helps somewhat, but I would have preferred smaller steps and more detailed explanations of what’s going on.

I’m trying to work through this but having trouble. First of all, when I drag in the UICollectionView, it doesn’t look like the image in this tutorial. There is no search bar.

Second, the “final” version builds, but when I try to run it in the simulator, I get a cascade of “unsatifiable constraints”.

I’m using Xcode Version 13.3 (13E113) on macOS Monterey (12.3)

This comment saved me a LOT of times. I hope the tutorial will be fixed because it can be pretty annoying for anyone who has really follow the tutorial through and tried their best to achieve the same results