Mobile China Forum App Conference 2011 iOS Session3. Follow Us #iOS
• Adjunct Professor
• Guest Lecture @ University
• Conference Speaker
• Technical Editor
Bess Ho
@bess
• Book Author
4. Follow Us #iOS
• 10 years in Web designer &
development
• 3 years in Mobile
Bess Ho
• Focus in UI & Architecture
@bess • Background in consumer
behavior & data analytic
• Advising startup at seed &
early stage
6. 93% of Fortune 500 companies
are testing or deploying the
iPhone.
Over 80% of the top hospitals in
the US are testing or piloting
iPads.
92% of the Fortune 500
companies are testing or
deploying iPad. It is unheard of.
11. Requirements
• Intel-based Mac OSX Snow Leopard or Lion
• Update Mac OSX Software 10.6.8 or 10.7
• Apple Developer Account
• Safari (FREE) Mac ($99/yr) iOS ($99/yr)
• iOS4.3 SDK
• Xcode 3 or Xcode 4 ($)
• Requires 5GB+ Download
• Requires 11GB+ Install
Bess.co 2011 Copyright © All rights are reserved
16. Xcode 4
IDE
UI Editor - Interface Builder
Debugger
Source code repository Management
Single “workspace window”
Bess.co 2011 Copyright © All rights are reserved
18. Xcode 4 workspace window
Bess.co 2011 Copyright © All rights are reserved
22. MVC
Model View Controller (MVC) pattern separates
application’s data structures (Model) from user interface
(View) with the connecting layer (Controller)
View Model
Controller
Bess.co 2011 Copyright © All rights are reserved
23. MVC
.xib Data
List of tasks
View Model State of each task
Object containing a table with
cells allowing text entry and
user interaction
Controller
ViewController
Respond to user input or inform
the view to update visual elements
Trigger Model to perform action
to data
Bess.co 2011 Copyright © All rights are reserved
24. Simple App
.xib
Interface Builder
View
Controller
Model
.h & .m
ViewController
Bess.co 2011 Copyright © All rights are reserved
25. Frameworks
UIKit.framework
Foundation.framework
CoreGraphics.framewrk
Bess.co 2011 Copyright © All rights are reserved
26. Frameworks
1) Cocoa Touch
touch and event-driven and interface components
Cocoa Touch
2) Media
Play and record audio; animation for 2D & 3D
Media
3) Core Services
Access lower level features such as files, networking,
Core Services location, in-app purchase
4) Core OS
Core OS Access to memory, file system, lower level networking
and hardware
Bess.co 2011 Copyright © All rights are reserved
29. View Controller
header file implementation file
(.h) (.m)
Declare Execute
• instance variables
• properties
• methods
Bess.co 2011 Copyright © All rights are reserved
30. Debugging
/* This is a comment */
/*
* This is a comment
* Continue into next line(s)
*/
// This is a Comment
Bess.co 2011 Copyright © All rights are reserved
31. Import Directive
helloiphoneViewController.h
Never include more than once
// Include header files
#import <UIKit/UIKit.h>
// Declare class names and its superclasses
@interface helloiphoneViewController : UIViewController
<UITableViewDelegate> {
}
// Declare properties and methods
// Close @interface directive
@end
Bess.co 2011 Copyright © All rights are reserved
32. Interface Directive
helloiphoneViewController.h
Protocol(s) Class Superclass
// Include header files
#import <UIKit/UIKit.h>
// Declare class names and its superclasses
@interface helloiphoneViewController : UIViewController
<UITableViewDelegate> {
}
@end
// Adding Multiple Delegates
<UITableViewDelegate, UIAccelerometerDelegate>
Bess.co 2011 Copyright © All rights are reserved
33. ViewController.h
helloiphoneViewController.h
#import <UIKit/UIKit.h>
@interface helloiphoneViewController : UIViewController {
UILabel *myLabel;
}
@property (nonatomic, retain) IBOutlet UILabel *myLabel;
-void()myMethod;
@end
Property
Instance variables Method
Bess.co 2011 Copyright © All rights are reserved
34. Declare Variable
Declare an UILabel variable named “myLabel”
// Declare UILabel variable
UILabel *myLabel;
Bess.co 2011 Copyright © All rights are reserved
35. Declare Property
1) Declare a property of UILabel object named “myLabel”
2) Assign IBOulet to UILabel object
3) Assign retain and nonatomic to UILabel object
// Declare UILabel variable
@property (nonatomic, retain) IBOutlet UILabel *myLabel;
Bess.co 2011 Copyright © All rights are reserved
36. Declare Method
Declare a method that implementation file is going to use
// Declare a method
-void()myMethod;
Bess.co 2011 Copyright © All rights are reserved
37. ViewController.m
helloiphoneViewController.m
#import directive #import "helloiphoneViewController.h"
@implementation @implementation helloiphoneViewController
section
@synthesize myLabel;
Synthesizing a property - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
Method Declaration
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end directive @end
Bess.co 2011 Copyright © All rights are reserved
38. IBOutlet vs IBAction
UIElements
Interface Builder
add
.xib
UIView
IBActions IBOutlets
Optional Always
ViewController
subclass
Add UI elements to UIView in Interface Builder. You
subclass UIViewController to add functionality. IBOutlets
hook up UIElements in UIView to access them. IBActions
trigger actions based on user gestures on UIView
elements. Bess.co 2011 Copyright © All rights are reserved
40. 320 pixel
480 pixel
iPhone /2011 Copyright © All rights are reserved Size
Bess.co
iTouch Screen
41. 640 pixel
960 pixel
iPhoneCopyright © All rights are reserved
Bess.co 2011
4 Screen Size
42. 768 pixel
1024 pixel
iPad Screen Size
Bess.co 2011 Copyright © All rights are reserved
43. Coding Options
Universal App
Bess.co 2011 Copyright © All rights are reserved
44. Icon.png Icon@2x.png iTunesArtwork
57 x 57 pixel
Icon-72.png 114 x 114 pixel
Icon-Small.png
72 x 72 pixel 29 x 29 pixel 512 x 512 pixel
Icon-Small-50.png Icon-Small@2x.png
50 x 50 pixel 58 x 58 pixel
App Icons reserved
Bess.co 2011 Copyright © All rights are
48. Q&A
Thank you
Find out class schedules
http://bit.ly/iOSClass
http://www.udemy.com/ios-development/
Bess.co 2011 Copyright © All rights are reserved
Notes de l'éditeur \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n