iPhone Development
Cocoa Touch
•
Interface Builder
• •
Drag-’n-drop UI Lots of UI, little code
• •
Lots of work done for you Strictly MVC
Note that there’s no code here, I just threw this together in five minutes in Interface Builder.
•
Lots of widgets, but not everything you will want! Custom widgets are easy Many simple animations
• •
Objective-C
• • • •
Strict superset of C OO, like C++ Bits of Smalltalk
If the thought of learning a new language excites you, you’ll be OK!
Largest obstacle, but not huge
• •
Apple has lots of example code I’ll help!
@interface Movie : NSObject { NSString * title; NSString * studio; } - (NSString *)summary; @property (copy) NSString * title; @property (copy) NSString * studio; @end @implementation Movie @synthesize title; @synthesize studio;
Quick example, just a class with t wo properties and a single function. Nothing iPhone here. Inherits from NSObject, which does all of the magic message passing stuff. stringWithFormat is like sprintf Note that getters and setters work alongside properties!
- (NSString *)summary { return [NSString stringWithFormat:@"%@ by %@.", self.title, self.studio]; } @end Movie * myMovie = [[Movie alloc] init]; myMovie.title = @"Top Gun"; myMovie.studio = @"Paramount Pictures"; NSLog(@"%@", [myMovie summary]);
The SDK
• • • •
Instruments = watch memory allocations, function calls, etc. with dtrace Simulator = obvious Xcode = the actual IDE: editor, build environment, etc IB = already introduced
Documentation == Excellent Lots of tools Only for Mac OS X 2 GB, free download
• •
developer.apple.com or get it from me...
University Program
•
If all else fails, you can use my key!
Running apps on an actual device usually costs $100/developer for certificates and other related costs
• •
Apple has “University Dev. Program” Free, as long as a professor signs up
Hardware Interaction
• • • •
Don’t know what you want to do OS 3.0 (beta) has new “accessory” API Can talk over Bluetooth+USB Need additional specs from Apple, emailed them last night
Effort Required
• • • •
lots of apps == it’s easy!
Lots of apps in the store Biggest road bump: Objective-C Second biggest: UI architecture After that, you’re golden
Demo!
(keep in mind, this was written over the course of a few hours, and has far to go!)