Docstoc

The iOS Platform.ppt

Document Sample
The iOS Platform.ppt Powered By Docstoc
					                      The iOS Programming
                                     From iOS reference Library
                                 iPhone Human Interface Guidelines
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/DevelopingSoftware/DevelopingSoftware.html
                          Human Interface Principles
•   Metaphors
•   Direct Manipulation
•   See & Point
•   Feedback
•   User Control
•   Aesthetic Integrity
                                    Objective-C
Architecture for iOS Applications

                  Cocoa Touch

                  Media Layer

                    Core OS

                Hardware Layer
                           Model-View-Controller
• Model
  – Logic Layer         Foundation Libraries



• View
   – IOS screens view   UI Kit Views Libraries



• Controller
   – Go between         UI Kit View Controllers
                                                            Projects
• All Objective-C Applications are organized in a Project
• Project contains
   – Source code
   – Assets
   – Requisite libraries
   – List of all files and assets
   – Object Code (result of compiling source code)
   – Runtime Code (result of building)
   – Executable Code ( result of linking)
• IDE – Integrated Development Environment
   – Xcode
   – Visual Studio
                                              Back to C
•   Objective-C is a superset of C
•   Let’s start with C
•   Then add objects and classes
•   Then take up Objective-C, iOS framework
                                           Brief History of C
• Bell Labs 1970s, Dennis Ritchie –
• New OS required more efficient, faster, smaller apps
• Developed C (discarded “B”)

• Brad J. Cox ,1980’s
• Objective-C was layered on top of C
• Creation of Objects was enabled

• NeXT Software licensed Objective-C software in 1988
• Developed libraries and dev environment: NEXTSTEP
• Open Sourced to GNU, 1992

• Apple acquired NeXT SW, 1996
• Objective-C 2.0 2007
                                  Places to Store Values
• Variables
   – Names contain letters, numbers, underscores
   – May not begin with a number
   – NO SPACES
   – Not reserved words

• Examples
   – sum, myLocation, i, _systemFlag

• Not exampes
   – sum$, 3Pieces, int

• Note: these are different variable names and use separate storage
   – sum, Sum, SUM
                                                 Storage Needs
• Different variables need varying amounts of space to store their
  data
   – Data Types
        • int – integers, + and – counting numbers and 0
             – Decimal representations 12000, -32768
             – Hexadecimal                #ccff33
             – Octal                      0123
        • float – decimal numbers
        • double – larger float numbers

       • char – characters ‘A’ and ‘a’, ‘2’ ( not the integer 2)
       • id – object of any type (Objective-C)
    – Qualifiers
       • Long, short, unsigned, signed
                       Storing Values into Variables
• Assignment statements
      int a = 42;
      Int b = 24;

     int result;

     result = a + b;      // addition
     result = a – b;      // subtraction
     result = a * b;      // multiplication
     result = a / b;      // division – no remainder
                             Arithmetic Expressions
• Order of operations
   – Parentheses
   – Exponents
   – Multiply and divide
   – Add and subtract
• Example:

                3 + 53 – 2(4 / 2)/2
Parentheses         3 + 53 – 2(2)/2
Exponents           3 + 125 – 2(2)/2
Multiply & Divide   3 + 125 – 2
Add & Subtract      126
                               Logical Expressions
• Logical operators
      >       Greater than
      <       Less than
      >=      Greater than OR equal
      <=      Less than OR equal
      ==      Is Equal To
      !=      Is NOT Equal to
• Example
      int a = 6;
      int b = 18;

      (a >= b)
                                               Decisions
if (expression) {

    Statements to do if expression is true ;
}
                                                 Decisions
 if (expression) {

      Statements to do if expression is true ;
 }
…………………………………………………………………
 if (expression) {

     Statements to do if expression is true ;
 } else {

     Statements to do if expression is NOT true ;
 }
                                          Repeating
• Loops
     do {

       Statements to be repeated while the expression
       is true

     } while (expression);
                                                 More
• There are more data types
• There are mot decision statements
• There are more loop statements

• This is enough to create a game in a console window.

• Guess my number

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:63
posted:5/16/2012
language:English
pages:16
wangnuanzg wangnuanzg http://
About