840 likes | 1.03k Views
iPhone Development. 박종화 suakii@gmail.com. Contents. Requirements iOS SDK iOSOverView Objective-C Design Pattern App Dev Cycle QA. Trend. Smartphone OS. Smartphone OS. Why?. Differences. Only One Running Application Only One Window Limited Access Limited Response Time
E N D
iPhone Development 박종화 suakii@gmail.com
Contents • Requirements • iOS SDK • iOSOverView • Objective-C • Design Pattern • App Dev Cycle • QA
Differences • Only One Running Application • Only One Window • Limited Access • Limited Response Time • Limited Screen Size • Limited System Resources • No Garbage Collection
Requirements • Intel Based Snow Leopard • iPhone or iPod Touch • Xcode • iOSSDK • Objected Oriented Concepts
Developer Programs • iOS Developer – Individual ($99/year) • iOSDeveloper – Enterprise ($299/year) • iOS Developer – Student ($0)
iPhone Platform • ARM Processor(Samsung, Apple) • 512MB RAM (iPhone4) • BSD UNIX • Mach kernel • COCOA APIs
SDK Tools • Frameworks • Xcode Tools • iPhone Simulator • iPhone Reference Library
Frameworks • Apple delivers most of its system interfaces in special packages called frameworks. • A framework is a directory that contains a dynamic shared library and the resources need to support that library
Xcode Tools Xcode Interface Builder Instruments
Xcode Tools • GCC compiler 4.2 • Support for Obj-C, C++, Java, Python and Ruby (iPhone only uses Obj-C & C++) • Code editor with code completion • Support for SVN and CVS
Interface Builder • Tool for laying out interfaces • Separate Tool from Xcode • Bind Actions and Outlets in Controllers
iOS 4.1 • Multitasking • Folders • Threaded email • iBooks • Game Center • Not support Flash or Java
iOS Core Services Cocoa Touch Core OS Media
iOS Core Services Cocoa Touch Core OS Media
iOS Core Services Cocoa Touch Core OS Media
iOS Core Services Cocoa Touch Core OS Media
Main.m #import <UIKit/UIKit.h> int main(intargc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePoolalloc] init]; intretVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; }
Performance • Do Not Block the Main Thread • Use Memory Efficiently • Floating-Point Math Considerations • Reduce Power Consumption • Tune Your Code • Improve File Access Times • Tune Your Networking Code
OO Terms • Class • Instance • Message • Method • Instance Variable • Inheritance • Superclass/Subclass • Protocol
Objective-C • Somewhere in-between C++ and Java • Created by Brad Cox & Tom Love • Invented in 1980’s for Next Computing • Based on C with SmallTalk like extentions • Used in COCOA, OpenStep and GNUStep • Class based OO language
Objective-C • 객체를 중심으로 작성 • 객체는 데이터와 데이터를 조작하는 동작으로 이루어진다. • 동작을 객체의 method, 객체의 데이터를 instance variable • Objective-C는 동적인 언어로서 실행시에 객체나 매소드가 변할 수 있다.
Class Interface #import <UIKit/Uikit.h> @interface HelloWorldViewController : UIViewController { //Instance Variable UIButton button; UILabel *label; } //property @property (nonautomatic, retain) IBOutletUILabel *label; //method -(IBAction)sayHello:(id)sender; @end
Class Implementation • #import “HelloWorldViewController.h” • @implementation HelloWorldViewController • @synthesize label; • -(IBAction) sayHello:(id) sender { • label.text = @”Hello, World”; • } • -(void)viewDidLoad { • } • (void)dealloc { [label release]; • [super dealloc]; • } • @end
Class Allocation • HelloWorldViewController *obj = [[HelloWorldViewControlleralloc] init];
Property • 인스턴스 변수에 대한 접근자메소드의 구현의 편리 label - getter setLabel: - setter • @synthesize • Dot Syntax label.text = @”Hello, World”; [label setText:@”Hello, World”];
Properties • Readonly • Retain • Readwrite • Copy • Assign