0%

Book Description

Want to write applications for iOS or the Mac? This introduction to programming and the Objective-C language is the first step on your journey from someone who uses apps to someone who writes them.

Based on Big Nerd Ranch's legendary Objective-C Bootcamp,¿this book covers C, Objective-C, and the common programming idioms that enable developers to make the most of Apple technologies.

This is the only introductory-level book written by Aaron Hillegass, one of the most experienced and authoritative voices in the iOS and Cocoa community.

Compatible with Xcode 4.2, iOS 5, and Mac OS X 10.7 (Lion), this guide features short chapters and engaging style to keep you motivated and moving forward. At the same time, Aaron’s determination that you understand what you’re doing—or at least why you’re doing it—encourages you to think critically as a programmer.

Table of Contents

  1. Title Page
  2. Acknowledgments
  3. I. Getting Started
    1. 1. You and This Book
      1. C and Objective-C
      2. How this book works
      3. How the life of a programmer works
    2. 2. Your First Program
      1. Installing Apple’s developer tools
      2. Getting started with Xcode
      3. Where do I start writing code?
      4. How do I run my program?
      5. So what is a program?
      6. Don’t stop
  4. II. How Programming Works
    1. 3. Variables and Types
      1. Types
      2. A program with variables
      3. Challenge
    2. 4. if/else
      1. Boolean variables
      2. else if
      3. For the More Curious: Conditional (ternary) operator
      4. Challenge
    3. 5. Functions
      1. When should I use a function?
      2. How do I write and use a function?
      3. How functions work together
      4. Local variables, frames, and the stack
      5. Recursion
      6. Looking at the frames in the debugger
      7. return
      8. Global and static variables
      9. Challenge
    4. 6. Numbers
      1. printf()
      2. Integers
        1. Tokens for displaying integers
        2. Integer operations
          1. Integer division
          2. Operator shorthand
      3. Floating-point numbers
        1. Tokens for displaying floating-point numbers
        2. Functions for floating-point numbers
      4. Challenge
    5. 7. Loops
      1. The while loop
      2. The for loop
      3. break
      4. continue
      5. The do-while loop
      6. Challenge
    6. 8. Addresses and Pointers
      1. Getting addresses
      2. Storing addresses in pointers
      3. Getting the data at an address
      4. How many bytes?
      5. NULL
      6. Stylish pointer declarations
      7. Challenges
    7. 9. Pass By Reference
      1. Writing pass-by-reference functions
      2. Avoid dereferencing NULL
    8. 10. Structs
      1. Challenge
    9. 11. The Heap
  5. III. Objective-C and Foundation
    1. 12. Objects
      1. Creating and using your first object
      2. Message anatomy
      3. Objects in memory
      4. id
      5. Challenge
    2. 13. More Messages
      1. Nesting message sends
      2. Multiple arguments
      3. Sending messages to nil
      4. Challenge
    3. 14. NSString
      1. Challenge
    4. 15. NSArray
      1. NSMutableArray
      2. Challenges
    5. 16. Developer Documentation
      1. Reference pages
      2. Quick Help
      3. Other options and resources
    6. 17. Your First Class
      1. Accessor methods
      2. Dot notation
      3. Properties
      4. self
      5. Multiple files
      6. Challenge
    7. 18. Inheritance
      1. Overriding methods
      2. super
      3. Challenge
    8. 19. Object Instance Variables
      1. Object ownership and ARC
        1. Creating the Asset class
        2. Adding a to-many relationship to Employee
      2. Challenge
    9. 20. Preventing Memory Leaks
      1. Retain cycles
      2. Weak references
      3. Zeroing of weak references
      4. For the More Curious: Manual reference counting and ARC History
        1. Retain count rules
    10. 21. Collection Classes
      1. NSArray/NSMutableArray
        1. Immutable objects
        2. Sorting
        3. Filtering
      2. NSSet/NSMutableSet
      3. NSDictionary/NSMutableDictionary
      4. C primitive types
      5. Collections and nil
      6. Challenge
    11. 22. Constants
      1. Preprocessor directives
      2. #include and #import
      3. #define
      4. Global variables
        1. enum
      5. #define vs global variables
    12. 23. Writing Files with NSString and NSData
      1. Writing an NSString to a file
      2. NSError
      3. Reading files with NSString
      4. Writing an NSData object to a file
      5. Reading an NSData from a file
    13. 24. Callbacks
      1. Target-action
      2. Helper objects
      3. Notifications
      4. Which to use?
      5. Callbacks and object ownership
    14. 25. Protocols
    15. 26. Property Lists
      1. Challenge
  6. IV. Event-Driven Applications
    1. 27. Your First iOS Application
      1. Getting started with iTahDoodle
      2. BNRAppDelegate
      3. Adding a C helper function
      4. Objects in iTahDoodle
      5. Model-View-Controller
      6. The application delegate
      7. Setting up views
        1. Running on the iOS simulator
      8. Wiring up the table view
      9. Adding new tasks
        1. Saving task data
      10. For the More Curious: What about main()?
    2. 28. Your First Cocoa Application
      1. Edit BNRDocument.h
      2. A look at Interface Builder
      3. Edit BNRDocument.xib
      4. Making connections
      5. Revisiting MVC
      6. Edit BNRDocument.m
      7. Challenges
  7. V. Advanced Objective-C
    1. 29. init
      1. Writing init methods
      2. A basic init method
      3. Using accessors
      4. init methods that take arguments
      5. Deadly init methods
    2. 30. Properties
      1. Property attributes
        1. Mutability
        2. Lifetime specifiers
          1. copy
          2. More about copying
        3. Advice on atomic vs. nonatomic
      2. Key-value coding
        1. Non-object types
    3. 31. Categories
    4. 32. Blocks
      1. Defining blocks
      2. Using blocks
        1. Declaring a block variable
        2. Assigning a block
        3. Passing in a block
      3. typedef
      4. Return values
      5. Memory management
      6. The block-based future
      7. Challenges
        1. Anonymous block
        2. NSNotificationCenter
  8. VI. Advanced C
    1. 33. Bitwise Operations
      1. Bitwise-OR
      2. Bitwise-AND
      3. Other bitwise operators
        1. Exclusive OR
        2. Complement
        3. Left-shift
        4. Right-shift
      4. Using enum to define bit masks
      5. More bytes
      6. Challenge
    2. 34. C Strings
      1. char
      2. char *
      3. String literals
      4. Converting to and from NSString
      5. Challenge
    3. 35. C Arrays
    4. 36. Command-Line Arguments
    5. 37. Switch Statements
  9. Next Steps
  10. Index
  11. More From Big Nerd Ranch...