For the More Curious: UICollectionView

The class UICollectionView is very similar to UITableView:

  • It is a subclass of UIScrollView.

  • It displays cells, although these cells inherit from UICollectionViewCell instead of UITableViewCell.

  • It has a data source that supplies it with those cells.

  • It has a delegate that gets informed about things like a cell being selected.

  • Similar to UITableViewController, UICollectionViewController is a view controller class that creates a UICollectionView as its view and becomes its delegate and data source.

How is the collection view different? A table view only displays one column of cells; this is a huge limitation on a large-screen device like an iPad. A collection view can layout those ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.