O'Reilly logo

Mastering iOS 11 Programming - Second Edition by Donny Wals

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and implementing a custom UICollectionViewCell

When you implemented the UITableViewCell in the previous chapter, you designed a custom cell. This cell was a view that was reused by the UITableView for every contact in the contacts array. UICollectionView also uses cells but you can not use UITableViewCell in a UICollectionView. However, the two different cells do share a lot of functionalities, such as the prepareForReuse method and the awakeFromNib method, we saw in the previous chapter, Chapter 1, UITableView Touchup.

When you replaced the table view with a collection view, you might have noticed that the collection view immediately contained a default cell. This cell is a lot more flexible than the table view cell was; you can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required