How to do it...

  1. Create a new Xcode project with the name Dynamic Cells and a Single View template.
  2. Add a UITableView with the delegate and data source set. Add a prototype cell with a basic style, as we did in section one. Implement the delegate and data source and display only four cells.
  3. In ViewController.swift, add the following titles to be displayed:
 let titles = ["This is very simple title", "Long text goes here\nLong text goes here\nLong text goes here\nLong text goes here\nLong text goes here\nLong text goes here", "Some text goes here, Some text goes here, Some text goes here, Some text goes here, Some text goes here", "Long text goes here\nLong text goes here\nLong text goes here\nLong text goes here\nLong text goes here\nLong ...

Get iOS Programming Cookbook 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.