hirevietnamese - lesson 1

24
HIREVIETNAMESE iPhone Training Lesson 1

Upload: le-ly

Post on 13-Jul-2015

839 views

Category:

Technology


0 download

TRANSCRIPT

HIREVIETNAMESE

iPhone TrainingLesson 1

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Contents

Introduction to iPhone Programming1

Getting Setup2

Programming Fundamentals3

Example 14

Exercise 15

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Introduction to iPhone Programming

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Introduction to iPhone Programming

Based on Objective-C Only one application running at a time (multi-tasking

implemented in OS 4) Only one window Limited Screen Size

480 x 320 pixels (iPhone, 3G, & 3GS) 960 x 640 (iPhone 4G) 1024 x 768 (iPad)

Limited System Resources

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Introduction to iPhone Programming

Model – View –Controller (MVC) is the method used for developing a mobile app with XCode: Model holds your application’s data View holds the window, controls and other

UI Controller Binds the model and view

together and decides how to handle user input

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Getting Setup

Resources you will need: Beginning iPhone 3 Development

Programming in Objective-C

Textbook

Mac OS 10.6.xand

iOS SDK 2.4.x

Software MAC MiniOr

MacBook Pro

Hardware

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

New Project

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

Tools -> Library

Interface Builder

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

Key objects in an iOS application

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

The Application Life Cycle

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming FundamentalsState Description

Not running The application has not been launched or was running but was terminated by the system.

Inactive The application is running in the foreground but is currently not receiving events.

Active The application is running in the foreground and is receiving events.

Background The application is in the background and executing code.

Suspended The application is in the background but is not executing code.

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

Launching into the active state

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

Moving from the foreground to the background

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

Handling application interruptions

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Programming Fundamentals

Transitioning from the background to the foreground

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Outlets and Actions

Outlet

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Outlets and Actions

UI Code

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Outlets and Actions

- (IBAction) gotoNext:(NSString*)str;

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

View Controllers

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

View Controllers

[navigationController pushViewController:viewController]

[viewController addSubView:view]

[self.window addSubview:navigationController.view]

[self.window makeKeyAndVisible]

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Example 1

Input name = empty

Tap on display button

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Example 1

If name == “HireVietnamese”

Tap on display button

HIREVIETNAMESEhttp://www.hirevietnamese.com HIREVIETNAMESE

Exercise 1

HIREVIETNAMESE