User Interface Controls in Xamarin.iOS
This document introduces some of the most common iOS user interface controls and how to use them.
Starting with iOS 8, UIAlertController has completed replaced UIActionSheet and UIAlertView both of which are now deprecated.
The UIButton class is used to represent various different styles of button in iOS screens. This section introduces the different options for working with buttons in iOS.
Collection Views, available in the
UICollectionView class, are a
new concept in iOS 6 that introduce presenting multiple items on the screen using layouts. The patterns for providing data to a
UICollectionView to create items and interact with those items follow the same delegation and data source patterns commonly used in iOS
Adding images to your app requires two steps: first, add the images to your project; then, add controls and code to display them on a screen. Refer to the Working with Images article for more detailed coverage of image handling in Xamarin.iOS.
The Manual Camera Controls, provided by the
AVFoundation Framework in iOS 8, allow a mobile application to take full control over an iOS device's camera. This fine-grained level of control can be used to create professional level camera applications and provide artist compositions by tweaking the parameters of the camera while taking a still image or video.
Maps are a common feature in all modern mobile operating systems. iOS offers mapping support natively through the Map Kit framework. With Map Kit, applications can easily add rich, interactive maps. These maps can be customized in a variety of ways, such as adding annotations to mark locations on a map, and overlaying graphics of arbitrary shapes. Map Kit even has built-in support for showing the current location of a device.
UILabel control is used for displaying single and multi-line, read only text.
The Picker control displays 'wheel-like' control that contains a scrollable list of values with the selected value being highlighted. Users rotate the wheel to select the option they want.
One specific user case for pickers it to set the date and / or time. To provide for this Apple has created a custom subclass of the UIPickerView class called UIDatePicker.
iOS provides two main ways to indicate progress in your app: Activity Indicators (including a specific network activity indicator) and Progress Bars.
The UISearchBar is used to search through a list of values.
The slider control allows for simple selection of a numeric value within a range. iOS uses the
UISwitch as a boolean input that may be represented by a radio-button on other platforms. A Segmented Control is an organized way to allow users to interact with a small number of options.
The Stack View control (
UIStackView) leverages the power of Auto Layout and Size Classes to manage a stack of subviews, either horizontally or vertically, which dynamically responds to the orientation and screen size of the iOS device.
This section introduces the classes used to create and display tables then provides examples of how to use them in Xamarin.iOS. It will cover using the default appearance for tables, customizing the layout, implementing editing and using the Xamarin iOS Designer to design a table visually. Sometimes the display is obviously a list of rows (such as the Music app) and other times it is difficult to recognize the table control (such as editing in the Contacts app, or a conversation in Messages app).
Accepting user text input is accomplished with the
UITextField for single-line inputs and UITextView for multi-line editable text. You can drag either of these controls onto a screen and double-click to set the initial text.
iOS applications using a tab-navigation UI are built using the UITabBarController class. In this article we’ll walk through how to set up a tabbed application that contains several controllers and views. We’ll then examine how to load a UITabBarController when it is not the root controller, such as after a login screen.
In this article, we will explore the web views provided by Apple–
SFSafariViewController–their similarities and differences, and how they can be used.