How to Customize Your iOS App Table View for the iPad
How to Use Inspector and Quick Help Pane for iOS App Development
How to Create an Xcode Project for an iPad App

Different Kinds of Views You Use in iOS Apps

Frameworks for iOS apps supply the classes you have to work with in your application — classes like UIView, UIViewController, UIControl, and a whole lot more. The UIView class defines the basic properties of a view, and you may be able to use it “as is” by simply adding an image view and some controls.

The UIKit framework also provides you with a number of other views that are subclassed from UIView. These views implement the kinds of things that you as a developer need to do in the user interface.

It’s important to think about the view objects that are part of the UIKit framework. When you use an object such as a UISlider or UIButton, your slider or button behaves just like a slider or button in any other iOS app. This enables the consistency in appearance and behavior across apps that users expect.

Controls

Controls are the fingertip-friendly graphics that are used extensively in a typical application’s user interface. Controls are actually subclasses of the UIControl superclass, a subclass of the UIView class.

They include touchable items such as buttons, sliders, and switches, as well as text fields in which you enter data. You use them in your views, including, as you just saw, in a toolbar.

Controls make heavy use of the Target-Action design pattern, which is used in this example app when you touch the Test Drive button as shown in this figure.

A button is the tip of the Target-Action design pattern.
A button is the tip of the Target-Action design pattern.

Display views

Think of Display views as controls that look good but don’t really do anything except, well, look good. These include the following: UIImageView (check out the background to the Master view shown in the figure for an example); UILabel (for adding labels to buttons and other controls); UIProgressView; and UIActivityIndicatorView.

You might like to add an activity indicator to those views where you download data so folks have something to watch while waiting.

Alert views and Action sheets

Alert views and Action sheets present a message to the user, along with buttons that allow the user to respond to the message. Alert views and Action sheets are similar in function but look and behave differently from one another.

For example, the UIAlertView class displays a blue alert box that pops up on the screen, and the UIActionSheet class displays a box that slides in from the bottom of the screen.

You could add an Alert view to your app to inform the user when the Internet isn't available. This figure shows an example of what the user would see if no Internet connection is available.

Users need the Internet alert, so be sure to include it.
Users need the Internet alert, so be sure to include it.

Navigation views

Tab bars and Navigation bars work in conjunction with view controllers to provide tools for navigating in your app. Normally, you don’t need to create a UITabBar or UINavigationBar directly — it’s easier to let Interface Builder do the job for you or configure these views through a Tab bar or Navigation controller, respectively.

The window

You’ll remember this one: The window provides the surface for drawing content and is the root container for all other views.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Add the Events Controller to Your iOS App
How to Use the Library Pane for iOS App Development
How to Use a Navigation Controller in the Master View for Your iOS App
How to Add a Button to Your iOS App
How to Add and Set Up the EventPageController in the MainStoryboard in Your iOS App
Advertisement

Inside Dummies.com