iOS training (intermediate)

Preview:

DESCRIPTION

 

Citation preview

Yahoo! Confidential 1

iOS Training (Intermediate)

Yahoo! Confidential

Gurpreet SinghSriram Viswanathan

Yahoo! Confidential

Topics

Protocols and Delegates Categories and Selectors Views and View Controllers

Introduction to View Controllers Types of View Controllers

Hands on example for Creating a View Controller Manipulating Views Adding Content to Application

Working with Images Adding Simple Animation

2

Yahoo! Confidential

Protocols and Delegates

Protocol Protocols declare methods that others are expected to implement Similar to interfaces in other languages Protocol does not require .m file. Protocol can have @optional methods

Delegate It allows one object to delegate part of its behavior to be handled by

another object.

3

Yahoo! Confidential

Topics

Protocols and Delegates Categories and Selectors Views and View Controllers

Introduction to View Controllers Types of View Controllers

Hands on example for Creating a View Controller Manipulating Views Adding Content to Application

Working with Images Adding Simple Animation

4

Yahoo! Confidential

Categories and Selectors

Categories: Lets you add methods to class without having access original code Access instance variable but can't add new ones

@implementation NSString (NumericComparison)

- (NSComparisonResult) compareNumerically:(NSString *) compareWithString {

// ADD NUMERIC SORTING LOGIC HERE

}

@end

Selectors: Selector is a way of specifying a method to call

@selector(methodName)

5

Yahoo! Confidential

Topics

Protocols and Delegates Categories and Selectors Views and View Controllers

Introduction to View Controllers Types of View Controllers

Hands on example for Creating a View Controller Manipulating Views Adding Content to Application

Working with Images Adding Simple Animation

6

Yahoo! Confidential

Introduction to View Controllers

Link between application’s data and user interface View controllers are traditional controller objects in the MVC design

pattern Responsible for fetching/initializing models Every view controller that Apple provides extends from the

UIViewController class You Manage Your Content Using Content View Controllers

A content view controller presents content on the screen using a view or a group of views organized into a view hierarchy.

Container View Controllers Manage Other View Controllers A container view controller contains content owned by other view controllers.

7

Yahoo! Confidential

Introduction to View Controllers

8

Every view is controlled by only one view controller. Each view controller interacts with a subset of your app’s data.

For example, the Photo controller needs to know only the photo to be displayed.

Yahoo! Confidential

Topics

Protocols and Delegates Categories and Selectors Views and View Controllers

Introduction to View Controllers Types of View Controllers

Hands on example for Creating a View Controller Manipulating Views Adding Content to Application

Working with Images Adding Simple Animation

9

Yahoo! Confidential 10

Types of View Controllers

Most commonly used UI View Controllers

UINavigationController

Navigation Controllers Manage Stacks of Other View Controllers

Yahoo! Confidential 11

Types of View Controllers

UITableViewController

Interesting features:• Lazy loading• Grouping

Yahoo! Confidential 12

Types of View Controllers

UITabBarController

Tab Bar Controllers Manage Independent Sets of View Controllers

Yahoo! Confidential 13

Types of View Controllers

UIPageViewController

Page View Controllers Manage Paged Display of View Controllers Apps can use a page view controller to present a paged view of content The page view controller itself manages the display of one or more content

view controllers, each of which provides a single page of content.

UISplitViewController

Split View Controllers Manage Two Panes of Information Apps can use a split view controller to manage two panes of information,

where both portions of the interface are themselves managed by view controllers.

This is interface is similar to a navigation controller, but it takes advantage of the larger screen size of iPad to present more content at a time.

Yahoo! Confidential 14

Types of View Controllers

View Controllers at a glance

Yahoo! Confidential

Topics

Protocols and Delegates Categories and Selectors Views and View Controllers

Introduction to View Controllers Types of View Controllers

Hands on example for Creating a View Controller Manipulating Views Adding Content to Application

Working with Images Adding Simple Animation

15