Xamarin.iOS – Creating Lists and Opening the Browser

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.

aa1cTrKw7PEdW3

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:

Ci17gCS_PHIUfe

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).

PipC_AnZwUmL-5

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/)

Here is the video walk-through for this lesson that shows how to setup a TableView and launch the browser window.

Leave a Reply

Your email address will not be published. Required fields are marked *