Building a Completed iPhone App
-
Upload
vu-tran-lam -
Category
Technology
-
view
445 -
download
4
description
Transcript of Building a Completed iPhone App
![Page 1: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/1.jpg)
Presented by Vu Tran Lam
Building aCompleted iPhone App
Friday, March 29, 13
![Page 2: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/2.jpg)
2
Could You Build Apps For This...?
Friday, March 29, 13
![Page 3: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/3.jpg)
...And This...?
Friday, March 29, 13
![Page 4: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/4.jpg)
Friday, March 29, 13
![Page 5: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/5.jpg)
Friday, March 29, 13
![Page 6: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/6.jpg)
L
6
Friday, March 29, 13
![Page 7: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/7.jpg)
Set UpWhen you develop apps, you use the iOS SDK and Xcode (Apple’s IDE). Xcode provides everything you need to create great apps for iPhone, iPod touch, and iPad. It includes a source editor, a graphical user interface editor, and many other features. Xcode employs a single window (workspace window), that presents most of the tools you need to develop apps. The iOS SDK extends the Xcode toolset to include the tools, compilers, and frameworks you need specifically for iOS.
Friday, March 29, 13
![Page 8: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/8.jpg)
LanguageObjective-C is an elegant object-oriented language that powers all iOS apps. You write Objective-C code to create your app, and you need to understand this language in order to use most application frameworks. Although you can use other languages for development, you can’t build an iOS app without Objective-C.
Friday, March 29, 13
![Page 9: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/9.jpg)
Friday, March 29, 13
![Page 10: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/10.jpg)
Development
Friday, March 29, 13
![Page 11: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/11.jpg)
• Frameworks
Development
Friday, March 29, 13
![Page 12: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/12.jpg)
FrameworksAn app consists of code that you write and frameworks provided by Apple. A framework contains a library of methods that your app can call. More than one app can access a framework library at the same time.
Friday, March 29, 13
![Page 13: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/13.jpg)
Using an Object-Oriented Framework
Friday, March 29, 13
![Page 14: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/14.jpg)
Handle the Events
Friday, March 29, 13
![Page 15: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/15.jpg)
Survey Major Frameworks
Friday, March 29, 13
![Page 16: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/16.jpg)
Survey Major Frameworks
Friday, March 29, 13
![Page 17: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/17.jpg)
• Frameworks• Design Patterns
Development
Friday, March 29, 13
![Page 18: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/18.jpg)
Design PatternsA design pattern solves a common software engineering problem. Patterns are abstract designs, not code. When you adopt a design, you adapt the general pattern to your specific needs.
Friday, March 29, 13
![Page 19: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/19.jpg)
Design Pattern: Model-View-Controller
Friday, March 29, 13
![Page 20: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/20.jpg)
Design Pattern: Model-View-Controller
Friday, March 29, 13
![Page 21: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/21.jpg)
• Frameworks• Design Patterns• Human Interface Design
Development
Friday, March 29, 13
![Page 22: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/22.jpg)
Human Interface DesignIt’s not enough to create an app that works. Users expect iOS apps to be intuitive, interactive, and engaging. Think about the user experience as you design every aspect of your app, from the features you choose to the way your app responds to a gesture.
Friday, March 29, 13
![Page 23: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/23.jpg)
Human Interface Design
• Types of App
Friday, March 29, 13
![Page 24: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/24.jpg)
Human Interface Design
• Types of App• Wireframing
Friday, March 29, 13
![Page 25: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/25.jpg)
Human Interface Design
• Types of App• Wireframing• Icons
Friday, March 29, 13
![Page 26: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/26.jpg)
• Frameworks• Design Patterns• Human Interface Design• App Design
Development
Friday, March 29, 13
![Page 27: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/27.jpg)
App Design
Friday, March 29, 13
![Page 28: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/28.jpg)
App Design
Before you begin writing a line of code, you should make some critical design decisions:• Be as specific as possible about your app’s purpose and features• Choose the kind of data model your app will use• Decide on UI style for your app (e.g. single view or master-detail) • Decide your app to be universal (runs on iPad, iPhone, iPod touch) These and other design decisions help you to construct the architecture of your app.
Friday, March 29, 13
![Page 29: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/29.jpg)
• Frameworks• Design Patterns• Human Interface Design• App Design• App Store
Development
Friday, March 29, 13
![Page 30: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/30.jpg)
App StoreTo make a great app, you need to test it on actual devices throughout the development process, not just in Simulator. To run an app on iOS-based devices, you need to register the devices you want to test on, create certificates that authorize developers to sign an app, and create an app ID to identify the app. Finally, you will do to publish an app on the App Store.
Friday, March 29, 13
![Page 31: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/31.jpg)
Xcode IDE
Friday, March 29, 13
![Page 32: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/32.jpg)
Xcode Workspace
Friday, March 29, 13
![Page 33: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/33.jpg)
Toolbar Xcode Workspace
Friday, March 29, 13
![Page 34: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/34.jpg)
Toolbar
Navigation Selector Bar
Filter Bar
Project Navigator
Xcode Workspace
Friday, March 29, 13
![Page 35: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/35.jpg)
Toolbar
Navigation Selector Bar
Filter Bar
Interface Builder
Project Navigator
Xcode Workspace
Friday, March 29, 13
![Page 36: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/36.jpg)
Toolbar
Navigation Selector Bar
Jump Bars
Filter Bar
Interface Builder Editor Area
Project Navigator
Xcode Workspace
Friday, March 29, 13
![Page 37: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/37.jpg)
Toolbar
Navigation Selector Bar
Library Selector Bar
Filter Bar
Inspector Selector Bar
Interface Builder Editor Area
Inspector Pane
Library Pane
Project Navigator
Jump Bars
Xcode Workspace
Friday, March 29, 13
![Page 38: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/38.jpg)
Toolbar
Navigation Selector Bar
Library Selector Bar
Filter Bar
Inspector Selector Bar
Debug Bar
Interface Builder Editor Area
Inspector Pane
Library Pane
Debug Area
Project Navigator
Jump Bars
Xcode Workspace
Friday, March 29, 13
![Page 39: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/39.jpg)
Friday, March 29, 13
![Page 40: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/40.jpg)
Your First iOS App - Hello World
Friday, March 29, 13
![Page 41: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/41.jpg)
Introduction
First iOS App introduces Three Ts of iOS app development:• Tools: How to use Xcode to create and manage a project?• Technologies: How to create an app that responds to user input?• Techniques: How to take advantage fundamental design patterns?
Friday, March 29, 13
![Page 42: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/42.jpg)
Part 1: Getting Started
• Create and Test a New Project• Anatomy of an Application• Find Out How an Application Starts Up
• Look at UIApplicationMain Function• Look at Storyboad File• Look at Property List File• Understand View and Window Architecture
Friday, March 29, 13
![Page 43: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/43.jpg)
Anatomy of an Application
• Compiled code• Storyboard files• Resources (images, sounds, strings, etc)• Info.plist file (application configuration)
Friday, March 29, 13
![Page 44: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/44.jpg)
• Compiled code• Your code• Framework
• Storyboard files• Resources (images, sounds, strings, etc)• Info.plist file (application configuration)
Anatomy of an Application
Friday, March 29, 13
![Page 45: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/45.jpg)
• Compiled code• Your code• Framework
• Storyboard files• UI elements and other objects• Details about object relationships
• Resources (images, sounds, strings, etc)• Info.plist file (application configuration)
Anatomy of an Application
Friday, March 29, 13
![Page 46: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/46.jpg)
Anatomy of an Application
Friday, March 29, 13
![Page 47: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/47.jpg)
Anatomy of an Application
Your Code
Friday, March 29, 13
![Page 48: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/48.jpg)
Anatomy of an Application
Your Code
Storyboard
Friday, March 29, 13
![Page 49: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/49.jpg)
Anatomy of an Application
Your Code
Storyboard
Info.plist File
Friday, March 29, 13
![Page 50: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/50.jpg)
Anatomy of an Application
Your Code
Storyboard
Info.plist File
Framework
Friday, March 29, 13
![Page 51: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/51.jpg)
Understanding View and Window ArchitectureViews and windows present your application’s user interface and handle the interactions with that interface. UIKit and other system frameworks provide a number of views that you can use as-is with little or no modification. You can also define custom views for places where you need to present content differently than the standard views allow.
Friday, March 29, 13
![Page 52: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/52.jpg)
Part 2: Inspecting View Controller and Its View
• Use Inspector to Examine View Controller• Open Inspector
• Change View’s Background Color• Set Background Color of View Controller’s View• Restore Background Color of View Controller’s View
Friday, March 29, 13
![Page 53: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/53.jpg)
Change View’s Background Color
Friday, March 29, 13
![Page 54: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/54.jpg)
Part 3: Configuring View
• Understand View Controller Basics• Add User Interface Elements• Create an Action for Button• Create Outlets for Text Field and Label• Make Text Field’s Delegate Connection• Test Application
Friday, March 29, 13
![Page 55: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/55.jpg)
Understand View Controller BasicsView controllers are a vital link between an app’s data and its visual appearance. Whenever an iOS app displays a user interface, the displayed content is managed by a view controller or a group of view controllers coordinating with each other. Therefore, view controllers provide the skeletal framework on which you build your apps.
Friday, March 29, 13
![Page 56: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/56.jpg)
Understand View Controller BasicsA key part of any view controller’s implementation is to manage the views used to display its content. It’s very difficult to manage many connections view controllers. Instead, use Interface Builder to create storyboards. Storyboards make it easier to visualize the relationships in your app and simplify the effort needed to initialize objects at runtime.
Interface Builder
Friday, March 29, 13
![Page 57: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/57.jpg)
Understand View Controller BasicsThis is “Hello World” window with its target screen and content views. On the left, you can see the objects that make up this interface and understand how they are connected to each other.
Friday, March 29, 13
![Page 58: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/58.jpg)
Add User Interface ElementsYou add user interface (UI) elements by dragging them from the object library to a view on the canvas. After adding UI elements, you can move and resize them.
Friday, March 29, 13
![Page 59: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/59.jpg)
Create an Action for ButtonControl-drag, press and hold the Control key while you drag from the button to the implementation file in the assistant editor pane. After that, you must input as following:
Friday, March 29, 13
![Page 60: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/60.jpg)
Create Outlet for Text FieldControl-drag, press and hold the Control key while you drag from the text field to the implementation file in the assistant editor pane. After that, you must input as following:
Friday, March 29, 13
![Page 61: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/61.jpg)
Create Outlet for LabelControl-drag, press and hold the Control key while you drag from the label to the implementation file in the assistant editor pane. After that, you must input as following:
Friday, March 29, 13
![Page 62: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/62.jpg)
Make Text Field’s Delegate ConnectionControl-drag, press and hold the Control key while you drag from text field to the yellow sphere in the scene dock. After that, you must input as following:
Control-drag and select delegate
Friday, March 29, 13
![Page 63: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/63.jpg)
Test Application
Friday, March 29, 13
![Page 64: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/64.jpg)
Part 4: Implementing View Controller
• Add a Property for User’s Name
Friday, March 29, 13
![Page 65: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/65.jpg)
Part 4: Implementing View Controller
• Add a Property for User’s Name
@property (copy, nonatomic) NSString *userName;
In HelloWorldViewController.h, type:
Friday, March 29, 13
![Page 66: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/66.jpg)
Part 4: Implementing View Controller
• Add a Property for User’s Name• Implement changeGreeting: Method
Friday, March 29, 13
![Page 67: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/67.jpg)
Part 4: Implementing View Controller
• Add a Property for User’s Name• Implement changeGreeting: Method
- (IBAction)changeGreeting:(id)sender{ self.userName = self.textField.text; NSString *nameString = self.userName; if (nameString.length == 0) { nameString = @"World"; }
NSString *greeting = [[NSString alloc] initWithFormat: @"Hello, %@!", nameString]; self.label.text = greeting;}
In HelloWorldViewController.m, type:- (IBAction)changeGreeting:(id)sender{ self.userName = self.textField.text; NSString *nameString = self.userName; if (nameString.length == 0) { nameString = @"World"; }
NSString *greeting = [[NSString alloc] initWithFormat: @"Hello, %@!", nameString]; self.label.text = greeting;}
In HelloWorldViewController.m, type:
Friday, March 29, 13
![Page 68: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/68.jpg)
Part 4: Implementing View Controller
• Add a Property for User’s Name• Implement changeGreeting: Method• Configure View Controller as Text Field’s Delegate
Friday, March 29, 13
![Page 69: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/69.jpg)
Part 4: Implementing View Controller
• Add a Property for User’s Name• Implement changeGreeting: Method• Configure View Controller as Text Field’s Delegate
- (BOOL) textFieldShouldReturn: (UITextField *)theTextField{ if (theTextField == self.textField) { [theTextField resignFirstResponder]; } return YES;}@end
In HelloWorldViewController.m, type:
In HelloWorldViewController.h, add <UITextFieldDelegate>:@interface HelloWorldViewController : UIViewController <UITextFieldDelegate>
Friday, March 29, 13
![Page 70: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/70.jpg)
Part 4: Implementing View Controller
• Add a Property for User’s Name• Implement changeGreeting: Method• Configure View Controller as Text Field’s Delegate• Run Application
Friday, March 29, 13
![Page 71: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/71.jpg)
Next...
Friday, March 29, 13
![Page 72: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/72.jpg)
MVC
Friday, March 29, 13
![Page 73: Building a Completed iPhone App](https://reader038.fdocuments.us/reader038/viewer/2022102901/554d1d4bb4c905c5208b480d/html5/thumbnails/73.jpg)
many thanks to
Thank you
Stanford Universityhttps://developer.apple.com
Developer Center
http://www.stanford.edu/class/cs193p
xin chào
Referenceshttp://az4you.wordpress.comhttp://www.slideshare.net/vutlam9083/building-a-completed-iphone-app
Friday, March 29, 13