O'Reilly logo

iOS Programming Cookbook by Hossam Ghareeb

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

Resizing table view cells dynamically

In the previous demos, we saw that all the cells have the static cell height that can be configured from the storyboard. In this section, we will learn to resize table view cells dynamically, that is, based on the content height you have in your cell. Use this feature only if you want your cell to be resized based on the content height. Autolayout will help us greatly in this section and I recommend revising/reading the Autolayout chapter before starting this section.

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 ...

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