16
User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Embed Size (px)

Citation preview

Page 1: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

User Interface ObjectsFrom Beginning iPhone 4 Development and The iPhone

Developer’s Cookbook (Chapter 4)

Page 2: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

User Interface Elements

Views—visuals, provide canvas, and other interface visual objects.

ViewControllers –provides a way for user to interact with your application. Can send an action (method) to a target (object) when an event (touch or tap) occurs.

Page 3: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Visual Classes

Parent class –UIView ClassAlmost all interface objects

are children of UIView classUIWindow—specialized

container and home for all the views Set screen size Only see one at a time

May have many views within a single window

Visual Quickstart Guide iPhone SDK 3, pg 100

Page 4: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Views that Display Data

UITextView Text box that may be used for

display or user input Limited to single font and font

size

UILabel Read-only text, limited size

UIImageViews Show pictures. Load with UIImage objects May load a sequence of images

rather than single image

Page 5: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Views that Display Data, cont…

UIWebView Display web content (HTML, PDF, etc) May use to present stylized text Support zoom and scroll

MKMapViews Enables maps into application Allow map annotation (MKannotationView

and MKPinAnnotionView)

UIScrollView Display larger than normal content Adds horizontal and/or vertical scrolling Supports zoom

Page 6: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Views for Making Choices

UIAlertViewPop-up windowsMay customize message and buttonsUse when have two to three choices

UIActionSheetMenus that scroll up from bottom of screenServe same function as Alert view.Use when have 4 or more choices

Page 7: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Inputs and Values

UIButtonDisplays a buttonTriggers an event/actionListed as Round Rect

Buttons

UISegmentedControlDisplays a row of equally

sized buttonsBehave as radio buttons

UISwitchOn-off switch display

Page 8: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

cont…

UISliderSlider along a horizontal

barSet value for the bar

UIPageControlLets user move between

pages

UITextFieldsOffer single line of text

input

Page 9: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Tables and Pickers

UITableViewScrolling list of choicesOffer rows of information

UIPickerSelect choices by scrolling

individual wheelsUIDatePicker is specialized

picker for dates

Page 10: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Bars

Compact views that extend from one side of screen to the other

Read the Human Interface Guidelines for limits on bar use before you add a specific bar.

UINavigationBar Used for navigation

UITabBar and UISearchBar

UIToolBar Provide a set of actions that act

on current view

Page 11: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Progress and Activity

UIActivityIndicatorViewSpinning wheel while task

is ongoingDoes not state when task

will end

UIProgressViewOffers bar that fills from

left to right

Page 12: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

UIView and UIViewControllers

UIView has a visual representation

UIViewControllers have NO visual representationManage viewsLinking views to codeHandle reorientation eventsHandle navigation issues such as switching between

views

Page 13: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

UIViewControllers

May be very general to very specific

Introduce functionality without additional programming

Limit or hide direct access to core featuresExample—camera access

Must use UIImagePickerController to snap a photo. Class pre-built GUI and will handle the taking of the photo and saving. After image is saved then pass control back to your application. No direct access to the camera or raw image data.

Page 14: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

UIViewController

Parent class of view controllers

Handle reorientation tasks

Set how views look and which subviews are displayed

Handle reaction to views being displayed or dismissed

Handle view changes

Page 15: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

UINavigationController

Allow navigate up and down hierarchies

Create navigation bars

Handles push new views and generate back buttons

Handles navigation details and includes a history stack

Page 16: User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)

Other Controllers

UITabBarController

UITableViewController

AddressBookUI.framework--has several controllers that allow access to address book information

UIIMagePickerController—allows access to photo album and to use the camera

MFMailComposeViewcontroller—allows creation of mail message

GKPeerPickerController—provides GUI for discovering and connecting with other iPhones

MPMediaPickerController—media selection GUI