Before you begin

This is an iOS class. To complete the coding exercises, you will need a Xamarin.iOS development environment with either the iOS Simulator or an iOS device to run the exercise on. Please read the setup requirements if you need help installing the Xamarin development environment.

Overview

In iOS, it's fairly rare to come across applications (that aren't games) which do not use a Table View. This commonly used control lets an application display a scrollable list of data which can be manipulated and often forms the basis of master/detail views. This class will go through the basics of using Table Views, getting them into your UI, populating them with data and performing some basic customizations.

Objectives

  1. Explore Table Views
  2. Utilize built-in cell styles
  3. Add selection behavior
  4. Implement cell reuse

Lecture

IOS110 - Fundamentals of TableViews.

Exercises

Exercise materials are available from GitHub. The code can be cloned through a desktop Git client or downloaded directly as a ZIP file.

  1. Add a Table View to an application
    Exercise
    In this group exercise, we will create a new iOS application and add a UITableView in code and through the Storyboard designer.
  2. Populating a Table View
    Exercise
    Next, you will populate your UITableView controls with data using a UITableViewSource and through the UITableViewController.
  3. Using the built-in cell styles
    Exercise
    The UITableViewCell has several different styles with subviews in different positions. In this group exercise, we will try out the various options to see how to display the data in different ways.
  4. Using the accessory styles and row selection
    Exercise
    While read-only Table Views are certainly valuable, we often want to respond to the user tapping on a row. In this exercise, we will add behavior into our application through the Table View delegate notification methods.
  5. Implement cell reuse
    Exercise
    In this final exercise, we will implement the GetCell method in the proper fashion - adding support to reuse the UITableViewCell elements.

Additional resources

Here are some additional documentation pages from Xamarin and Apple which are useful reading to provide an alternative learning path.

Tables in Xamarin.iOS About Table Views in iOS Apps Table View Styles and Accessory Views UITableView reference