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
- Explore Table Views
- Utilize built-in cell styles
- Add selection behavior
- 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.
- Add a Table View to an applicationExercise
In this group exercise, we will create a new iOS application and add aUITableView
in code and through the Storyboard designer. - Populating a Table ViewExercise
Next, you will populate yourUITableView
controls with data using aUITableViewSource
and through theUITableViewController
. - Using the built-in cell stylesExercise
TheUITableViewCell
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. - Using the accessory styles and row selectionExercise
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. - Implement cell reuseExercise
In this final exercise, we will implement theGetCell
method in the proper fashion - adding support to reuse theUITableViewCell
elements.
Additional resources
Here are some additional documentation pages from Xamarin and Apple which are useful reading to provide an alternative learning path.