Custom Table Cells

To create a custom table cell, it usually makes sense to create a subclass of UITableViewCell and give that subclass public properties for the fields that we’ll need to update from tableView(cellForRowAtIndexPath:). So, in the File Navigator, select the Pragmatic Tweets group, go to FileNewFile, and choose the Cocoa Touch Class template. In the next pane of the assistant, name the class ParsedTweetCell, and set the Subclass of: to UITableViewCell. We don’t need to do anything with the code yet, but it will help us in the Storyboard to have this class already created.

Back in Main.storyboard, select the table view. We could edit the existing prototype cell, but just to prove that we can juggle multiple prototypes, let’s create ...

Get iOS 8 SDK Development, 2nd Edition 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.