The Tables UITableViewController
Displaying a list is one of the most common design patterns used in mobile applications. Tables are one of the single most important controls in iOS applications. It’s hard to find an application that doesn’t use tables in some form. Tables in iOS are highly customizable and wrap a lot of functionality that we get for free.
The source for the data displayed in the TableView can come from objects such as arrays or Lists. You can also bind to a data source such as a database table.
In order to determine what should happen when a row is clicked, you can use the RowSelected event.
A UITableView can have a ‘grouped’ or ‘plain’ style, and consists of the following parts:
- Section Header
- Cells (or rows, if you prefer)
- Section Footer
- Editing mode (includes ‘swipe to delete’ and drag handles to change row order)
There is a lot of functionality to make your TableViews really pop in your application.
- Swipe to delete individual cells.
- Entering Edit mode to reveal delete buttons on each row
- Entering Edit mode to reveal re-ordering handles.
- Inserting new cells (with animation).
The primary classes used to display table views are shown here
In this tutorial, we will be using UITableViewSource – Xamarin.iOS-exclusive abstract class that provides all the methods required to display a table, including row count, returning a cell view for each row, handling row selection and many other optional features. Youmust subclass this to get a UITableView working.
Opening the Browser
When we want to perform actions using another app on the device, we can do a SharedApplication call. This is part of the UIApplication class, which holds all of the central administrative properties for any application running on iOS (more here: https://developer.xamarin.com/api/type/UIKit.UIApplication/)