You want to display a collection view on the screen.
Either use an instance of the
UICollectionView as a subview of another view
in your app or (if you want a full-screen collection view) use the
Just like table views, a collection view, as its name indicates, is a view and can be added as a subview to other views. So when you are creating your app, think about whether your collection view has to be the main view of a view controller or should appear as a small portion of another view.
Let’s explore the full-screen scenario first. Follow these steps to create a simple app that displays a full-screen collection view on the screen:
From the File menu, choose New, and then choose Project.
On the left, choose the iOS main category, and under that choose Application. On the righthand side of the screen, choose Empty Application, and then press the Next button.
On the next screen, enter your project information and ensure that the Use Automatic Reference Counting box is ticked, as shown in Figure 5-3. Once you are done entering the relevant values, press the Next button.
You are now asked to save your project on disk. Choose a suitable place to save your project, and then press the Create button.
Now that you have your project set up, create a new class in
your project and call it
ViewController. This class has to subclass
won’t need a .xib file for this view ...