Table of Contents

Cocoa and Objective-C: Up and Running

  1. Setup and First Run
    • Download and Install Xcode
    • Your First Application
      • Create the Interface
      • Run the Finished Application
  2. Thinking in Code: Basic C
    • How Code Works
    • How to Format Code
    • Variables
      • Types
      • Constants
      • Enumerated Types
      • Typedefs
    • Functions
      • Declaring Functions
    • Example: FirstProgram
      • Displaying Values in the Command Line
      • Compile and Run the Example
    • Scope
      • Static Variables
    • Conditionals
    • Example: ShoppingTrip
      • Compile and Run
    • Wrap Up
  3. Memory and Pointers: Advanced C
    • Arrays
    • Loops
    • Text Strings
    • Multi-Dimensional Arrays
    • Pointers
      • The Purpose of Pointers
      • Using Pointers
      • Pointers and the Const Keyword
    • Dynamic Memory
    • Strings and Dynamic Memory
      • Returning Strings from Functions
    • Arrays of Strings
    • Example: Address Book
      • Compile and Run the "Address Book" Example
    • Structs
    • Header Files
    • Compile and Run the "Header File Test" Example
    • Create Files for the Song Struct
    • Final Example
    • Wrap Up
  4. Thinking in Objects
    • Structs and Classes
      • Designing Classes
    • Accessors
    • Inheritance
    • Composition
    • Object Lifetime
    • Built-In Classes
    • Wrap Up
  5. Basic Objective-C
    • NSString Basics
    • Using Methods
      • Nested Method Calls
      • Multi-Input Methods
    • Accessors
      • Dot Syntax
    • Creating Objects
    • Basic Memory Management
      • Using Autorelease Directly
    • Declaring a Class
      • Add Methods
    • Implementing a Class
      • Init
      • Dealloc
    • Example: Photo Info
    • Wrap Up
  6. More Objective-C
    • More on Memory Management
      • The Life of an Instance Variable
      • Copying Objects
    • Class Name Prefixes
    • Properties
      • Property Options
    • 64-Bit Objective-C
      • Enabling 64-bit
      • Should I Use 64-bit?
      • All Further Examples Assume 64-bit
    • Categories
      • Categories for Private Methods
    • Introspection
    • Protocols
    • Dynamic Messaging
      • Using Selectors to Call Methods
      • Forwarding Messages
    • Exceptions
    • Example: DataCollector
      • Some New Classes and Methods
      • Create the Files
      • Build and Run
    • Wrap Up
  7. Foundation Value Classes
    • NSString
      • Ranges and Substrings
      • Using NSString with C Types
      • Comparing Strings for Equality
      • Strings as File Paths
      • Reading and Writing Files With Strings
    • Mutability
      • Advantages of Mutability
      • Advantages of Immutability
    • Core Foundation
      • Memory Management
      • Core Foundation Mutability
      • Toll-Free Bridging
      • Core Foundation Types as Properties
      • Drawbacks of Core Foundation Types
      • Open Source
    • NSNumber
      • CFNumberRef
      • Cocoa Primitive Types
      • NSDecimalNumber
      • NSNumberFormatter
      • When To Use Which Number Type
    • NSData
      • NSMutableData
    • NSArray
      • Fast Enumeration
      • Blocks
      • NSMutableArray
      • CFArrayRef
      • NSIndexSet
    • NSDictionary
      • NSMutableDictionary
      • CFDictionaryRef
    • NSSet
      • NSMutableSet
    • NSValue
    • NSDate
      • CFDateRef
  8. Basic Controls
    • How to Use this Chapter
    • Windows and Views
    • Targets and Actions
      • Buttons
      • Declaring Action Methods
      • Connecting Actions
      • Menus
      • Responder Chain
      • Pop Up Buttons
      • Sliders
      • Text Fields
    • Outlets
    • Datasources
      • Table View Datasource Methods
      • Implementing Datasource Methods
    • Bindings
      • Key-Value Protocols
      • Bindings for Simple Controls
      • Bindings for Complex Controls
      • Tips for Debugging Bindings
  9. Designing Applications Using MVC
    • About This Project
      • Window Controllers
      • View Controllers
      • Core Data
    • Create the Project Files
      • Create the Entities
      • Add Attributes and Relationships
      • Update the App Delegate
      • Add Quartz Framework
      • Create the Window Controller
      • Create the View Controllers
      • Create the Managed Object Classes
    • Create the User Interface
      • Remove the Default Window
      • Create the Main Window Interface
      • Create the Browser Interface
      • Create the Editor View Interface
      • Create the List View Interface
    • Run the Application
    • Preparing for Release
  10. Custom Views and Drawing
    • Basic Geometry
      • Geometry Structs as Strings
      • Geometry Structs as NSValues
      • Cocoa View Coordinates
      • Derived Rects
      • Comparison Functions
    • Basic Drawing
      • NSColor
      • Subclassing NSView
      • Instantiate the View
      • The Graphics Context
    • Bezier Paths
      • Drawing Polygons
      • Drawing Curved Paths
    • Images
      • Loading Image Data
      • Drawing Images in a View
    • Shadows
      • Add a Shadow to StyledImageView
    • Gradients
      • Drawing a Gradient Background
      • Drawing an Image Sheen
    • Refactoring View Code
      • Why You Should Refactor
      • Goals for Refactoring
      • Refactored Header
      • Refactored Implementation
      • Test the Refactored Version
    • Text
      • Fonts
      • Attributed Strings
      • Add a Title to StyledImageView
    • Handling Mouse and Keyboard Events
      • Keyboard Events
      • Mouse Events
      • Add Event Support to StyledImageView
  11. The Final Word
    • The List
    • Websites
    • Last Thought