How to do it...

  1. Create a new Xcode project with our lovely template Single View template and name it Collection View.
  2. Open the storyboard file and select our lonely view controller and change its size to iPhone 4-inch.
  3. Select the View Controller, go to Editor | Embed In | UINavigationController to automatically make your view controller a root view controller of a navigation controller:
  1. From Object Library, drag the UICollectionView and add it as a subview. Change its frame to (X = 0, Y = 0, Width = 375, Height = 603).
  2. Add constraints to make your collection view always at the location (0, 0) and with the size same as that of the screen. ...

Get iOS Programming Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.