1 / 36

iPhone Development

iPhone Development. JaxCodeCamp 2009. Who am I. David Fekke .NET Developer, ColdFusion Work at LPS Presenter JaxDug, JaxJug, JSUG & JaxFusion Mac User 1986. Alan Kay. Smalltalk is object-oriented, but it should have been message oriented. Alan Kay.

melora
Download Presentation

iPhone Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. iPhone Development • JaxCodeCamp 2009

  2. Who am I • David Fekke • .NET Developer, ColdFusion • Work at LPS • Presenter JaxDug, JaxJug, JSUG & JaxFusion • Mac User 1986

  3. Alan Kay • Smalltalk is object-oriented, but it should have been message oriented.

  4. Alan Kay • When I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.

  5. Bjarne Stroustrup • C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg.

  6. The Apple Way

  7. Assumptions • Somewhat familiar with OO concepts • Used a language like Java, C# or C++ • Open minded • Actually used an iPhone or iPod Touch

  8. Requirements • You need a Intel Mac with OX 10.5 • Some knowledge of OO concepts • Xcode tools (FREE) • iPhone (SDK)

  9. Developer Programs • iPhone Individual ($99) • iPhone Enterprise ($399) • iPhone Student

  10. App Store • Submit Apps with Individual program • Apple keeps 30%, you keep 70% • Refunds: you pay 100%

  11. iPhone Platform • ARM Processor • 128/256 MB RAM • BSD UNIX • Mach Microkernel • COCOA APIs

  12. COCOA • COCOA is a OO Framework • Based on NextStep • Mostly written in Objective-C • iPhone uses COCOA Touch

  13. COCOA Framework • NS (NextStep) • CF (Core Foundation) • CA (Core Animation) • CI (Core Image) • Core Data • OpenGL

  14. COCOA Conventions • Most classes begin with NS, I.E. NSObject, NSString, NSArray or NSNumber • Designed around MVC pattern • Heavy use of delegation • iPhone specific components based on UIKit

  15. COCOA Touch APIs • Accelerometer • Location API • Multi-Touch • Camera/Video Input • Map Interface • OpenGL ES

  16. Objective-C • Somewhere in-between C++ and Java • Invented in 1980’s for Next Computing • Based on C with SmallTalk like extentions • Used in COCOA, OpenStep and GNUStep • Class based OO language

  17. -(BOOL)validateNumRangeWithStartNumber:(int)startNumber EndNum:(int) endNumber • { • if (startNumber >= endNumber) • { • UIAlertView *alertView = [[UIAlertView alloc] • initWithTitle:@"End value Too Small" • message:@"Sorry" • delegate:nil • cancelButtonTitle:@"OK" • otherButtonTitles:nil]; • [alertView show]; • [alertView release]; • return YES; • } else { • return NO; • } • }

  18. Obj-C vs C#

  19. Objective-C Structure • Obj-C Class composed of two files: header and implementation, or .h and .m • header uses the @interface and implementation uses @implementation

  20. #import <UIKit/UIKit.h> @interface LottoRandomAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; } @property (nonatomic, retain) IBOutletUIWindow *window; @end

  21. #import "LottoRandomAppDelegate.h" @implementation LottoRandomAppDelegate @synthesize window; - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch [windowmakeKeyAndVisible]; } - (void)dealloc { [windowrelease]; [superdealloc]; } @end

  22. Selectors • SEL type defines a method signature • -(void)setAction:(SEL)aSelector • SEL mySelector; • mySelector = @selector(drawMyView:); • [myButton setAction:mySelector];

  23. Memory Management • C used methods like malloc and free • Obj-C uses object retain pool • Garbage Collection on the Mac, but not on the iPhone • Inherit management methods from NSObject

  24. Memory Management Cont. • NSString *myName = [[NSString alloc] init]; • // retain count of 1 • [myName retain]; • // retain count of 2 • [myName release]; • // retain count reduced to 1 • [myName autorelease]; • // object released by pool magically

  25. MVC • Model-View-Controller • COCOA has Controller classes • UIViewController Class • Views are in the XIB (NIB) files

  26. Controllers • iPhone Apps commonly have multiple views • Push and Pop the Controllers for each View • Navigation Controller used to load different views • UINavigationController

  27. SDK Tools • Xcode 3.0 IDE • Interface Builder (Views) • Instruments (Profiler tool) • iPhone Simulator

  28. Xcode 3 • 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

  29. Interface Builder • Tool for laying out interfaces • Separate Tool from Xcode • Bind Actions and Outlets in Controllers

  30. Demo

  31. Internet Resources • http://developer.apple.com • http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/ObjectiveC/ • http://www.stanford.edu/class/cs193p/cgi-bin/index.php • http://www.cocoadev.com/

  32. Book Resources • COCOA Programming For Mac OS X by Aaron Hillegass • iPhone Developer’s Cookbook by Erica Sadun • APress Books

  33. Snow Leopard • Mac OS X 10.6 released yesterday • Optimized for 64bit • Xcode 3.2 • Static Analysis Code warning and hinting • OpenCL Library • Grand Central Dispatch

  34. Mono Touch • Develop iPhone Apps with C# • Mono IDE • Ahead of time compilation • Works with IB

  35. Contact • davidfekke@gmail.com • twitter.com/davidfekke • http://www.fekke.com/blog/

  36. Questions?

More Related