• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
iPhone Programming in 30 minutes (?) [FTS]
 

iPhone Programming in 30 minutes (?) [FTS]

on

  • 1,334 views

Talk at PhD Computer Science students’ Journal Club in Cardiff University (FTS - Food, Talks and Stuff).

Talk at PhD Computer Science students’ Journal Club in Cardiff University (FTS - Food, Talks and Stuff).

Statistics

Views

Total Views
1,334
Views on SlideShare
1,334
Embed Views
0

Actions

Likes
0
Downloads
48
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    iPhone Programming in 30 minutes (?) [FTS] iPhone Programming in 30 minutes (?) [FTS] Presentation Transcript

    • FTS seminar 27.01.2010 iPhone Programming in ~30 mins (?) Diego Pizzocaro
    • DisclaimerThese slides are heavily based on Evan Doll and Alan Cannistraro’s slides prepared for iPhone App Programming course @ Stanford http://www.stanford.edu/class/cs193p Look for iPhone Application Programming in iTunes U for videopodcasts.
    • Crash course• iPhone OS overview• Objective-C• Model-View-Controller (MVC)
    • iPhone OS overview
    • iPhone
    • Mac OS X Cocoa Media Core Services Core OS
    • iPhoneCocoa Touch UI application framework which as a developer you Media are using the mostCore Services Core OS
    • Developing on iPhone Tools ToolsTools Xcode Interface Builder Xcode Xcode Interface Builder Interface Builder Tools Xcode Interface Builder Cocoa Touch FrameworksFrameworks Frameworks Frameworks Foundation Foundation UIKit UIKit Foundation Foundation UIKit UIKit LanguageLanguage Language [textView setStringValue: @“Hello”]; [textView setStringValue: @“Hello”]; [textView setStringValue: @“Hello”]; (& Runtime)(& Runtime) (& Runtime) Language [textView setStringValue: @“Hello”]; Objective-C Objective-C Objective-C (& Runtime) Objective-C
    • Objective-C
    • Objective-C• Strict superset of C ‣ Mix C with Obj-C• Object oriented language• Based on message passing (similar to Smalltalk)• No garbage collector need to manually manage memory (not covered in this presentation)
    • Message Syntax[receiver message];[receiver message:argument];[receiver message:arg1 andArg:arg2];
    • Message ExamplesBankAccount *myAccount; //assume this existsint n = [myAccount accountNumber];[myAccount deposit:100];if([myAccount isNotEmpty]) { [myAccount withdraw:50 printReceipt:YES];}
    • Some new types• Anonymous Objects• Class• ...others but no time! (Selectors “SEL”, Boolean “BOOL”, etc.)
    • Anonymous Objects• Normal (or Statically-typed) object BankAccount *anAccount• Anonymous (or Dynamically-typed) object id anAccount - Just id (Not id*) - id is the data type that indicates that we are talking about an object
    • Class• class instances responds to instance methods “-” - (id)init; - (double)accountNumber; int n = [myAccount accountNumber];• classes responds to class methods “+” (like Java “static” methods) + (id)alloc; + (float)stdInterestRate; float rate = [BankAccount stdInterestRate];
    • Defining aaclass Defining a class Defining classA public header and a private implementation A public header and a private implementation A public header and a private implementation Header File File Header Header File Implementation File Implementation File File Implementation
    • Defining a class Defining a class DemoA public header and a private implementation A public header and a private implementation BankAccount class BankAccount.h Header File File Header BankAccount.m Implementation File File Implementation
    • Model - View - Controller (MVC)
    • Address Book
    • App ArchitectureModel View Controller
    • MVC• Only the Controller knows both Model and View• Makes code more reusable (especially the Model part) Interface Builder Model View Controller Xcode
    • Demo BankAccount app View Model ✓ MainWindow.xib BankAccount BankAccount BankAccount balance balancebalance Value Changed - initWithBalance EVENT- -initWithBalance -initWithBalance setBalance -setBalance setBalance- - balance--balance balance Controller AccountController slider Outlets label myBankAccount Action - updateAccount
    • Demo BankAccount app View Model ✓ MainWindow.xib BankAccount BankAccount BankAccount balance balancebalance Value Changed - initWithBalance EVENT- -initWithBalance -initWithBalance setBalance -setBalance setBalance- - balance--balance balance Controller AccountController slider label myBankAccount - updateAccount
    • Your turn! ;) • http://www.stanford.edu/class/cs193p • http://cs193p.com/ • iTunes U - “iPhone Application Programming” • iPhone Developer Program (FREE, but cannot deploy on real iPhone) • users.cs.cf.ac.uk/D.PizzocaroImage from: http://www.trumpetvine.com/sketchblog/wp-content/images/2007.07/iphone_lg.jpg