You also add strikethrough, subscript, or superscript to text in Excel. Let cell = tableView.To apply your preferred style(s), select the cell(s) you wish to change, and then click on the B for bold, I for italics, or U for underlining. Replace tableView(_:cellForRowAt:) with the following: Configuring the Table Viewįirst, you need to configure the table view to use AuteurTableViewCell. Now, you’ll see:īefore the cells can become dynamic, you need to write a bit of code. Now that you’ve connected bioLabel to the top and bottom margins by 0 points, Auto Layout can determine the height of the cell!Īwesome, you’ve set up AuteurTableViewCell! Build and run. 8 points from the leading and trailing margins.0 points from the top and bottom margins.This ensures that, no matter how big or small the cell may be, the bio label is always: Next, change the leading and trailing values to 8 and click Add 4 Constraints. In this menu, select the four red lines near the top of the dialog. Click the Add New Constraints button at the bottom of your storyboard.
Note: If you’re not familiar with Auto Layout, or if you’d like a refresher to understand how to set up Auto Layout constraints, look at our Auto Layout in iOS tutorial. Set the new label’s Lines property, which is the maximum number of lines the label can have, to 0 in the Attributes inspector. In the Identity inspector, set the class to AuteurTableViewCell:Ĭlick the + button above the storyboard layout to open the Library. In the Auteurs Scene, select the AuteurCell in the table view. This is where the author’s bio information will be displayed. Add the following weak var bioLabel: UILabel! In the Project navigator, open AuteurTableViewCell.swift. To get dynamic cell heights working properly, create a custom table view cell, then set it up with Auto Layout constraints. You’ll start by implementing dynamic cell heights in AuteurListViewController. Your cell heights need to change dynamically, depending on each cell’s content.ĭon’t panique! Self-sizing cells are très faciles - very easy. You can’t just increase the cell size and call it a wrap because each piece of information and each image will be a different size. Not only is the app missing images of each auteur, but the information you’re trying to display is also cut off. You’ll see AuteurListViewController displaying a list of auteurs. Auteur Detail View Controller Scene, which displays the auteur’s films and information about each one.Auteurs Scene, which shows a list of auteurs.
AuteurListViewController, a top-level navigation controller.From the Project navigator, open Main.storyboard. Open the Auteurs.xcodeproj in the starter folder. That’s what you’ll do to help your client. Set the estimatedRowHeight or implement the height estimation delegate method.Set the table view’s rowHeight to tomaticDimension.Use Auto Layout for the UI elements inside the table view cells.With a few exceptions, all you have to do is: With all the improvements to Interface Builder, it’s easy to use Auto Layout to create self-sizing table view cells! Auto Layout was a big deal.įlash forward to now. Developers rejoiced parties commenced in the streets bands wrote songs to celebrate its greatness. You suddenly feel the urge to don a spiffy beret and start shouting orders!īack in the days of iOS 6, Apple introduced a wonderful new technology: Auto Layout. Our table view cells have to resize (gulp!) dynamically! Can you make it work?” “We started making the app, but we’re stumped at how to display the content in a table view. Not every director is an auteur - only those who have powerful creative control over the finished movie. It basically means the director is the driving creative force behind a film. The auteur theory of film making arose in France in the 1940s. “Auteurs?” you ask, “That sounds French.” Imagine you have a movie-crazy client who wants an app to show off the work of their favorite film directors.
Getting Startedĭownload the starter project by clicking the Download Materials button at the top or bottom of this tutorial. Note: This tutorial assumes you have a basic familiarity with Auto Layout and table views.