Iphone App-Introduction

download Iphone App-Introduction

of 49

Transcript of Iphone App-Introduction

  • 8/14/2019 Iphone App-Introduction

    1/49

    Welcome to CS193P:iPhone Application Development

    Evan Doll [email protected] Cannistraro [email protected]

    Thursday, April 2, 2009

    mailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]
  • 8/14/2019 Iphone App-Introduction

    2/49

    Staff

    Lecturers! Evan Doll [email protected]

    ! Alan Cannistraro [email protected]

    Student TAs!Troy Brant [email protected]

    ! Paul Salzman [email protected]

    Professor Emeritus! Paul Marcos [email protected]

    Thursday, April 2, 2009

    mailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]
  • 8/14/2019 Iphone App-Introduction

    3/49

    How many of you...

    Are familiar with object-oriented programming?

    Have developed software with Mac OS X?

    Have developed apps for the iPhone?

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    4/49

  • 8/14/2019 Iphone App-Introduction

    5/49

    Requirements

    Prerequisite: CS 106B/X

    Recommended Book: None, well use Apple documentation

    You must have access to an Intel-based Macintosh! Running Mac OS X 10.5 Leopard

    !

    iPhone SDK(Not available on cluster computers!) Owning an iPhone or iPod Touch is not required

    ! Assignments may be done with the iPhone Simulator

    ! Loaner iPod Touches should be available, more details to come

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    6/49

    Enrollment

    Response has been phenomenal again this quarter!! Enrollment limited to 60 students

    ! 40 graded, 20 Pass/No Credit

    ! Being signed up on Axess does not mean youre enrolled

    You MUST fill out a survey to be considered!! http://tinyurl.com/cs193p-spring09-survey! Required by noon tomorrow (April 2)

    ! Indicate whether youre willing to enroll P/NC

    Enrollment will be determined based on prior CS courses, otherrelevant experience, number of quarters remaining, major

    Non-enrolled may still attend lectures as auditors

    Thursday, April 2, 2009

    http://tinyurl.com/cs193p-spring09-surveyhttp://tinyurl.com/cs193p-spring09-surveyhttp://tinyurl.com/cs193p-spring09-survey
  • 8/14/2019 Iphone App-Introduction

    7/49

    iPhone Developer University Program

    Stanford has joined the iPhone Developer University Program

    Free on-device development for students (normally $99)! Valid through the end of the quarter

    ! Invites will only be issued to @stanford.edu email addresses

    Youll need to click through a student agreement which youshould read

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    8/49

    iPhone OS 3.0 Beta

    We wont be discussing the upcoming iPhone OS 3.0! Currently covered by an NDA

    Superset of iPhone OS 2.0 from a developer perspective

    Everything youll be learning this quarter will still be useful!

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    9/49

    Expanding our classroom...CS193P will be available on iTunes U this quarter

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    10/49

  • 8/14/2019 Iphone App-Introduction

    11/49

    CS193P on iTunes U

    For viewers on iTunes U...! Welcome to Stanford!

    ! Feedback and suggestions are welcome

    ! We cant answer individual questions via email

    ! Visit http://devforums.apple.com

    Thursday, April 2, 2009

    http://devforums.apple.com/http://devforums.apple.com/
  • 8/14/2019 Iphone App-Introduction

    12/49

    Getting More Info

    Email! [email protected]

    ! Questions from enrolled students only, please!

    Course web site! http://cs193p.stanford.edu

    Other web sites! iPhone Dev Center: http://developer.apple.com/iphone

    ! Developer Forums: http://devforums.apple.com

    Thursday, April 2, 2009

    http://devforums.apple.com/http://developer.apple.com/iphonehttp://cs193p.stanford.edu/http://cs193p.stanford.edu/mailto:[email protected]:[email protected]://devforums.apple.com/http://devforums.apple.com/http://developer.apple.com/iphonehttp://developer.apple.com/iphone
  • 8/14/2019 Iphone App-Introduction

    13/49

    Why Are We Here?

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    14/49

    Why Are We Here?

    To build iPhone & iPod touch applicationsusing Cocoa Touch

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    15/49

  • 8/14/2019 Iphone App-Introduction

    16/49

    Cocoa Touch & iPhone SDK

    Based on Cocoa! Mature, polished, highly consistent APIs

    Provides a very rich starting point for exploring app design

    Shows real-world implementations of OO design patterns

    Designs learned on iPhone translate directly to Mac OS X

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    17/49

    What Well Cover This Quarter

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    18/49

    Xcode Interface BuilderTools

    Language(& Runtime)

    Objective-C

    [textView setStringValue: @Hello];

    Frameworks

    Foundation UIKit

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    19/49

    Why Objective-C?

    Exposure to other languages is always good

    ObjC is a language focused on simplicity and the elegance ofobject oriented design! Based on ANSI C

    ! Brings many object oriented principles, but with a minimal

    amount of syntax

    A data point to compare with designs of C, C++, Java andother languages

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    20/49

    Applications You Will Build

    HelloStanford & Obj-C Tool

    HelloPoly - 2 weeks

    Presence - 4 weeks

    Final Project (your choice) - 3 weeks

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    21/49

    Assignments, Grading & Late Policy

    7 weekly assignments

    Final project of your choice! End of quarter demos at Apple...

    Grading: Nice & simple: #,#+ and #-

    Late Policy: 3 late days, use them wisely!

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    22/49

  • 8/14/2019 Iphone App-Introduction

    23/49

    Presence

    The Hello World of iPhone applications...! A client

    Build a fully functional application from scratch over 4 weeks

    Each assignment builds on the previous one

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    24/49

  • 8/14/2019 Iphone App-Introduction

    25/49

    What Well Cover

    Application design patterns

    View controllers

    Displaying data!Table views

    Dealing with local & remote data! Property lists, SQLite, web services

    Text input

    Multithreading

    Address Book and other system integration

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    26/49

    Final Projects

    Last 3 weeks of the course

    By yourself or with a partner

    Its never too early to think of something and propose it to us

    Categories to consider:! Student life apps

    ! Educational tools

    ! Games

    ! Social / location-aware software

    Something that you or your friends would actually like to use! Post it on the app store?

    ! http://www.stanfordiphoneclassapps.com

    Thursday, April 2, 2009

    http://www.stanfordiphoneclassapps.com/http://www.stanfordiphoneclassapps.com/http://www.stanfordiphoneclassapps.com/
  • 8/14/2019 Iphone App-Introduction

    27/49

  • 8/14/2019 Iphone App-Introduction

    28/49

    iPhone OS Overview

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    29/49

    iPhone

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    30/49

    Mac OS X

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    31/49

    Media

    Core Services

    Core OS

    Cocoa

    Mac OS X

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    32/49

    Media

    Core Services

    Core OS

    Cocoa Touch

    iPhone OS

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    33/49

  • 8/14/2019 Iphone App-Introduction

    34/49

    Core Services

    Collections Core Location

    Address Book Net Services

    Networking Threading

    File Access Preferences

    SQLite URL utilities

    Media

    Core Services

    Core OS

    Cocoa Touch

    iPhone OS

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    35/49

    Media

    Core Audio JPG, PNG, TIFF

    OpenAL PDF

    Audio Mixing Quartz (2D)

    Audio Recording Core Animation

    Video Playback OpenGL ES

    Media

    Core Services

    Core OS

    Cocoa Touch

    iPhone OS

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    36/49

    Cocoa Touch

    Multi-Touch Events Alerts

    Multi-Touch Controls Web Views

    Accelerometer People Picker

    View Hierarchy Image Picker

    Localization Controllers

    Media

    Core Services

    Core OS

    Cocoa Touch

    iPhone OS

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    37/49

    Xcode Interface BuilderTools

    Language(& Runtime)

    Objective-C

    [textView setStringValue: @Hello];

    Frameworks

    Foundation UIKit

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    38/49

    Cocoa Touch Architecture

    UIKit User interface elementsApplication runtimeEvent handling

    Hardware APIs

    Foundation Utility classesCollection classesObject wrappers for system services

    Subset of Foundation in Cocoa

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    39/49

    Objects

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    40/49

  • 8/14/2019 Iphone App-Introduction

    41/49

    Thing

    doSomething

    Behavior

    behavior

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    42/49

    Thing

    doSomething

    Message

    "doSomething"

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    43/49

    Thing

    flag

    count

    doSomething

    State

    state

    behavior

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    44/49

    Thing

    flag

    count

    doSomething

    Other Objects As State

    helper

    state

    doSomethingElse

    Other Thing

    performDifficultTask

    behavior

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    45/49

    Controller

    slider

    label

    updateLabel

    Outlets

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    46/49

    Controller

    slider

    label

    updateLabel

    Target / Action

    targetaction !updateLabel"

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    47/49

    Demo

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    48/49

    What did we just see?

    Keep application logic separate from interface elements

    Outlets connect controllers to views

    Use target/action to customize behavior! Dont require subclassing

    Thursday, April 2, 2009

  • 8/14/2019 Iphone App-Introduction

    49/49

    Questions?