Objective-C for Absolute Beginners: iPhone, iPad, and Mac Programming Made Easy

Book description

It seems as if everyone is writing applications for Apple's iPhone and iPad, but how do they all do it? It's best to learn Objective-C, the native language of both the iOSand Mac OS X, but where to begin? Right here, even if you've never programmed before!

Objective-C for Absolute Beginners will teach you how to write software for your Mac, iPhone,or iPad using Objective-C, an elegant and powerful language with a rich set of developer tools. Using a hands-on approach, you'll learn to think in programming terms, how to use Objective-C to build program logic, and how towrite your own applications and apps.

With over 50 collective years in software development and based on an approach pioneered at Carnegie Mellon University, the authors have developed a remarkably effective approach to learning Objective-C. Since the introduction of Apple's iPhone, theauthors have taught hundreds of absolute beginners how to develop Mac, iPhone,and iPad apps, including many that became popular apps in the iTunes App Store.

Table of contents

  1. Copyright
  2. About the Authors
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
    1. For the Newbie
    2. For the More Experienced
    3. Why Alice: An Innovative 3D Programming Environment
    4. How This Book Is Organized
    5. The Formula for Success
    6. The Development Technology Stack
    7. Required Software, Materials, and Equipment
      1. Operating System and IDE
      2. Software Development Kits
      3. Dual Monitors
      4. Book Forum
  6. 1. Becoming a Great iPhone/iPad or Mac Programmer
    1. 1.1. Thinking Like a Developer
    2. 1.2. Completing the Development Cycle
    3. 1.3. Introducing Object Oriented Programming
    4. 1.4. Working with the Alice Interface
    5. 1.5. Summary
    6. 1.6. Exercises
  7. 2. Programming Basics
    1. 2.1. Taking a Tour with Alice
      1. 2.1.1. Navigation Menu
      2. 2.1.2. World Window
      3. 2.1.3. Classes, Objects, and Instances in Alice
      4. 2.1.4. Object Tree
      5. 2.1.5. Editor Area
      6. 2.1.6. Details Area
      7. 2.1.7. Events Area
    2. 2.2. Creating an Alice App—To the Moon Alice
    3. 2.3. Your First Objective-C Program
      1. 2.3.1. Installing Xcode
      2. 2.3.2. Launching and Using Xcode
    4. 2.4. Summary
    5. 2.5. Exercises
  8. 3. It's All About the Data
    1. 3.1. Numbering Systems Used in Programming
      1. 3.1.1. Bits
        1. 3.1.1.1. Moore's Law
      2. 3.1.2. Bytes
      3. 3.1.3. Hexadecimal
      4. 3.1.4. Unicode
    2. 3.2. Data Types
    3. 3.3. Using Variable and Data Types with Alice
    4. 3.4. Data Types and Objective-C
    5. 3.5. Identifying Problems
    6. 3.6. Summary
    7. 3.7. Exercises
  9. 4. Making Decisions About...and Planning Program Flow
    1. 4.1. Boolean Logic
      1. 4.1.1. Truth Tables
      2. 4.1.2. Comparison Operators
    2. 4.2. Designing Apps
      1. 4.2.1. Pseudo-code
    3. 4.3. Design Requirements
      1. 4.3.1. Flowcharting
      2. 4.3.2. Designing and Flowcharting an Example App
      3. 4.3.3. The App's Design
      4. 4.3.4. Using Loops to Repeat Program Statements
        1. 4.3.4.1. Count-Controlled Loops
        2. 4.3.4.2. Condition-Controlled Loops
        3. 4.3.4.3. Infinite Loops
    4. 4.4. Coding the Example App in Alice
    5. 4.5. Coding the Example App in Objective-C
    6. 4.6. Nested If Statements and Else-If Statements
    7. 4.7. Improving the Code Through Refactoring
    8. 4.8. Moving Forward Without Alice
    9. 4.9. Summary
    10. 4.10. Exercises
  10. 5. Object Oriented Programming with Objective-C
    1. 5.1. The Object
    2. 5.2. What Is a Class
    3. 5.3. Planning Classes
    4. 5.4. Inheritance
    5. 5.5. Why Use OOP?
      1. 5.5.1. Eliminate Redundant Code
      2. 5.5.2. Ease of Debugging
      3. 5.5.3. Ease of Replacement
    6. 5.6. Advanced Topics
      1. 5.6.1. Interface
      2. 5.6.2. Polymorphism
    7. 5.7. Summary
    8. 5.8. Exercises
  11. 6. Introducing Objective-C and Xcode
    1. 6.1. A Brief History of Objective-C
    2. 6.2. Understanding C Language Basics
    3. 6.3. Putting the "Objective" into Objective-C
    4. 6.4. Introducing Xcode
    5. 6.5. Starting Up Xcode
    6. 6.6. Creating Your First Project
      1. 6.6.1. Adding a New Class
      2. 6.6.2. Building and Running the New Program
    7. 6.7. Summary
    8. 6.8. Exercises
  12. 7. Objective-C Classes, Objects, and Methods
    1. 7.1. Creating an Objective-C Class
      1. 7.1.1. Declaring Interfaces and Instance Variables
      2. 7.1.2. Sending Messages (Methods)
        1. 7.1.2.1. Using Class Methods
        2. 7.1.2.2. Using Instance Methods
      3. 7.1.3. Working with the Implementation File
      4. 7.1.4. Implementing Methods
    2. 7.2. Using Our New Class
      1. 7.2.1. Overriding Default Behavior
      2. 7.2.2. Taking Class Methods to the Next Level
    3. 7.3. Accessing the Xcode Documentation
    4. 7.4. Summary
    5. 7.5. Exercises
  13. 8. Programming Basics in Objective-C
    1. 8.1. Creating a Simple Command Line Tool
    2. 8.2. Introducing Instance Variables
      1. 8.2.1. Accessing Instance Variables
      2. 8.2.2. Using Getter and Setter Methods
    3. 8.3. Introducing Properties
      1. 8.3.1. Using Properties
      2. 8.3.2. Understanding the Importance of Conventions
    4. 8.4. Creating the MyBookstore Program
      1. 8.4.1. Using the NSMutableDictionary Class
      2. 8.4.2. Making Our Object Do Something
      3. 8.4.3. Implementing Behavior
      4. 8.4.4. Cleaning Up Our Objects
      5. 8.4.5. Using the Bookstore and Book Objects
    5. 8.5. Summary
    6. 8.6. Exercises
  14. 9. Comparing Data
    1. 9.1. Introducing Boolean Logic
    2. 9.2. Using Relational Operators
      1. 9.2.1. Comparing Numbers
        1. 9.2.1.1. Creating an Example Xcode App
    3. 9.3. Using Boolean Expressions
      1. 9.3.1. Comparing Strings
      2. 9.3.2. Comparing Dates
      3. 9.3.3. Combining Comparisons
    4. 9.4. Using the Switch Statement
    5. 9.5. Grouping Variables Together
      1. 9.5.1. NSArray
      2. 9.5.2. NSMutableArray
      3. 9.5.3. NSDictionary
      4. 9.5.4. NSMutableDictionary
    6. 9.6. Summary
    7. 9.7. Exercises
  15. 10. Creating User Interfaces with Interface Builder
    1. 10.1. Understanding Interface Builder
    2. 10.2. The Model-View-Controller
    3. 10.3. Human Interface Guidelines (HIGs)
    4. 10.4. Creating an Example iPhone App with Interface Builder
      1. 10.4.1. Using Outlets
      2. 10.4.2. Implementing an Action
      3. 10.4.3. Using Interface Builder
      4. 10.4.4. Document Window
      5. 10.4.5. Library Window
      6. 10.4.6. Inspector Window
      7. 10.4.7. Creating the View
      8. 10.4.8. Connecting the Outlets and Objects
      9. 10.4.9. Connecting Actions and Objects
      10. 10.4.10. Implementation File
    5. 10.5. Broken Connections in Interface Builder
    6. 10.6. Summary
    7. 10.7. Exercises
  16. 11. Memory, Addresses, and Pointers
    1. 11.1. Understanding Memory
      1. 11.1.1. Bits, Bytes, and Bases
        1. 11.1.1.1. Converting Base-10 (Decimal) to Base-2 (Binary)
        2. 11.1.1.2. Using Base-16 (Hexadecimal) Numbering
    2. 11.2. Understanding Memory Address Basics
      1. 11.2.1.
        1. 11.2.1.1. Using the Dereference Operator
    3. 11.3. Requesting Memory
      1. 11.3.1. Working with Automatic Variables and Pointers
    4. 11.4. Deallocating Memory
      1. 11.4.1. Using Special Pointers
    5. 11.5. Managing Memory in Objective-C
      1. 11.5.1. Using the Retain/Release Model
      2. 11.5.2. Working with Implied Retain Messages
      3. 11.5.3. Sending the dealloc Message
    6. 11.6. If Things Go Wrong
    7. 11.7. Summary
    8. 11.8. Exercises
  17. 12. Debugging Programs with Xcode
    1. 12.1. Getting Started with Debugging
      1. 12.1.1. Setting Breakpoints
      2. 12.1.2. Debugging Basics
      3. 12.1.3. Working with the Debugger Controls
    2. 12.2. Debugging a Program
      1. 12.2.1. Using the Step Controls
      2. 12.2.2. Looking at the Thread Window and Call Stack
      3. 12.2.3. Debugging Variables
      4. 12.2.4. Deleting Multiple Breakpoints
      5. 12.2.5. Disabling Breakpoints
      6. 12.2.6. A Larger Call Stack
    3. 12.3. Summary
    4. 12.4. Exercises
  18. 13. Storing Information
    1. 13.1. Storage Considerations
    2. 13.2. Preferences
      1. 13.2.1. Writing Preferences
      2. 13.2.2. Reading Preferences
    3. 13.3. Databases
    4. 13.4. Storing Information in a Database
    5. 13.5. Getting Started with Core Data
    6. 13.6. The Model
      1. 13.6.1. Managed Object Context
    7. 13.7. Setting Up the Interface
    8. 13.8. Summary
    9. 13.9. Exercises
  19. 14. Protocols and Delegates
    1. 14.1. Multiple Inheritance
    2. 14.2. Understanding Protocols
      1. 14.2.1. Protocol Syntax
    3. 14.3. Understanding Delegates
    4. 14.4. Next Steps
    5. 14.5. Summary

Product information

  • Title: Objective-C for Absolute Beginners: iPhone, iPad, and Mac Programming Made Easy
  • Author(s):
  • Release date: August 2010
  • Publisher(s): Apress
  • ISBN: 9781430228325