You are previewing Learning Cocoa with Objective-C, 3rd Edition.
O'Reilly logo
Learning Cocoa with Objective-C, 3rd Edition

Book Description

Get up to speed on Cocoa and Objective-C for developing Mac OS X, iPhone, iPad, and iPod touch applications. If you don’t have experience developing on the Apple platform, no problem. This updated book covers everything you need to get started—from object-oriented programming to working with iCloud.

Table of Contents

  1. Learning Cocoa with Objective-C
  2. A Note Regarding Supplemental Files
  3. Preface
    1. Audience
    2. Organization of This Book
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. How to Contact Us
    7. Acknowledgments
  4. 1. Cocoa Development Tools
    1. The Mac and iOS Developer Programs
      1. Registering for a Developer Program
      2. Downloading Xcode from Apple Developer
    2. Getting Around in Xcode
      1. The Xcode Interface
        1. The editor
        2. The toolbar
        3. The navigator
        4. Utilities
        5. The debug area
    3. Developing a Simple Objective-C Application
      1. Designing the Interface
      2. Connecting the Code
    4. Using the iOS Simulator
  5. 2. Object-Oriented Programming with Objective-C
    1. Object-Oriented Programming
      1. Objects
      2. Inheritance
      3. Interfaces and Implementations
      4. Methods
      5. Messages
      6. Properties
      7. Protocols
      8. Class Extensions
    2. Memory Management
      1. Reference Counting
      2. Automatic Reference Counting
      3. Object Graphs in Objective-C
    3. The NSObject Life Cycle
      1. Allocation and Initialization
      2. Retain and Release
      3. Finalization and Deallocation
  6. 3. Foundation
    1. Mutable and Immutable Objects
    2. Strings
      1. Creating Strings
      2. Working with Strings
        1. Capitalization and working with paths
        2. Finding substrings
      3. Comparing Strings
      4. Searching Strings
    3. Arrays
      1. Fast Enumeration
      2. Mutable Arrays
    4. Dictionaries
    5. NSValue and NSNumber
    6. Data
      1. Loading Data from Files and URLs
      2. Serialization and Deserialization
    7. Design Patterns in Cocoa
      1. Model-View-Controller
      2. Delegation
      3. Key-Value Observing
  7. 4. Applications on OS X and iOS
    1. What Is an Application?
      1. Applications, Frameworks, Utilities, and More
      2. What Are Apps Composed Of?
      3. Using NSBundle to Find Resources in Applications
    2. The Application Lifecycle
      1. OS X Applications
      2. iOS Applications
        1. Multitasking on iOS
    3. The Application Sandbox
      1. Application Restrictions
        1. iOS application restrictions
        2. Mac application restrictions
        3. Private APIs
  8. 5. Graphical User Interfaces
    1. Interfaces in OS X and iOS
    2. MVC and Application Design
    3. Nib Files
      1. Structure of a Nib File
      2. Outlets and Actions
      3. How Nib Files Are Loaded
    4. Constructing an Interface
      1. Guidelines and Constraints
    5. Building an App with Nibs and Constraints
    6. Core Animation
      1. Layers
      2. Animations
        1. Animations on OS X
        2. Animations on iOS
  9. 6. Blocks and Operation Quotes
    1. Blocks
      1. Block Syntax
      2. Block Life Cycles
      3. Methods with Block Parameters
      4. Blocks and Memory Management
      5. Modifying Local Variables from Inside Blocks with __block
    2. Concurrency with Operation Queues
      1. Operation Queues and NSOperation
      2. Performing Work on Operation Queues
    3. Putting It All Together
  10. 7. Drawing Graphics in Views
    1. How Drawing Works
    2. The Pixel Grid
      1. Retina Displays
      2. Pixels and Screen Points
    3. Drawing in Views
      1. Frame Rectangles
      2. Bounds Rectangles
    4. Building a Custom View
      1. Creating the Project
      2. Filling with a Solid Color
      3. Working with Paths
      4. Creating Custom Paths
      5. Multiple Subpaths
      6. Shadows
        1. Saving and restoring graphics contexts
        2. Drawing a shadow
        3. Drawing shadows on iOS
      7. Gradients
        1. Drawing gradients on iOS
      8. Transforms
  11. 8. Audio and Video
    1. AV Foundation
    2. Playing Video with AVPlayer
      1. AVPlayerLayer
      2. Putting It Together
    3. Playing Sound with AVAudioPlayer
    4. Working with the Photo Library
      1. Capturing Photos and Video from the Camera
      2. Building a Photo Application
      3. The Photo Library
  12. 9. Model Objects and Data Storage
    1. Key-Value Coding
    2. Key-Value Observing
      1. Registering for Change Notifications
      2. Notifying Observers of Changes
    3. Notifications with NSNotification
    4. Preferences
      1. Registering Default Preferences
      2. Accessing Preferences
      3. Setting Preferences
    5. Working with the Filesystem
      1. Using NSFileManager
        1. Creating directories
        2. Creating files
        3. Removing files
        4. Moving and copying files
      2. File Storage Locations
    6. Working with the Sandbox
      1. Enabling Sandboxing
      2. Open and Save Panels
      3. Security-Scoped Bookmarks
  13. 10. Cocoa Bindings
    1. Binding Views to Models
    2. A Single Bindings App
    3. Binding to Controllers
    4. Array and Object Controllers
    5. A More Complex Bindings App
  14. 11. Table Views and Collection Views
    1. Data Sources and Delegates
    2. Table Views
    3. UITableView on iOS
      1. Sections and Rows
      2. Table View Controllers
      3. Table View Cells
        1. Cell reuse
        2. Anatomy of a UITableViewCell
        3. Preparing table views in Interface Builder
        4. Analyzing tableView:cellForRowAtIndexPath:
        5. Responding to actions
      4. Implementing a Table View
    4. NSTableView on OS X
      1. Sorting a Table View
      2. NSTableView with Bindings
    5. Collection Views
      1. UICollectionView on iOS
  15. 12. Document-Based Applications
    1. The NSDocument and UIDocument Classes
    2. Document Objects in MVC
    3. Kinds of Documents
    4. The Role of Documents
    5. Document-Based Applications on OS X
      1. Autosaving and Versions
      2. Representing Documents with NSDocument
      3. Saving Simple Data
      4. Saving More Complex Data
    6. Document-Based Applications on iOS
      1. Representing Documents with UIDocument
  16. 13. Networking
    1. Connections
      1. NSURL
      2. NSURLRequest
      3. NSURLConnection
      4. NSURLResponse and NSHTTPURLResponse
    2. Building a Networked Application
    3. Discovering Nearby Services
      1. Browsing for Shared iTunes Libraries
  17. 14. Working with the Real World
    1. Working with Location
      1. Location Hardware
        1. GPS
        2. WiFi base station lookups
        3. Cell tower lookups
      2. The Core Location Framework
      3. Working with Core Location
    2. Geocoding
    3. Locations and Privacy
    4. Device Motion
      1. Working with Core Motion
    5. Printing Documents
      1. Printing on OS X
      2. Printing on iOS
  18. 15. Event Kit
    1. Understanding Events
      1. Accessing the Event Store
      2. Accessing Calendars
      3. Accessing Events
    2. Working with Events
    3. Building an Events Application
    4. User Privacy
  19. 16. Instruments and the Debugger
    1. Getting Started with Instruments
      1. The Instruments Interface
      2. Observing Data
      3. Adding Instruments from the Library
    2. Fixing Problems with Instruments
    3. Retain Cycles and Leaks
    4. Using the Debugger
      1. Setting Breakpoints
        1. Controlling program flow
        2. Custom breakpoints
        3. Exception and symbolic breakpoints
      2. Inspecting Memory Contents
      3. Working with the Debugger Console
  20. 17. Sharing and Notifications
    1. Sharing
      1. Sharing on iOS
      2. Sharing on OS X
    2. Notifications
      1. Push Notifications
        1. What happens when a push arrives
      2. Sending Push Notifications
      3. Setting Up to Receive Push Notifications
      4. Receiving Push Notifications
      5. Local Notifications
  21. 18. Nonstandard Apps
    1. Command-Line Tools
    2. Preference Panes
      1. How Preference Panes Work
      2. Preference Domains
      3. Building a Sample Preference Pane
    3. Status Bar Items
      1. Building a Status Bar App
  22. 19. Working with Text
    1. Internationalization and Localization
      1. Strings Files
      2. Creating a Sample Localized Application
    2. Formatting Data with NSFormatter
      1. Formatting Dates with NSDateFormatter
    3. Detecting Data with NSDataDetector
      1. Testing a Data Detector
  23. 20. iCloud
    1. What iCloud Stores
    2. Setting Up for iCloud
    3. Testing Whether iCloud Works
    4. Storing Settings
    5. iCloud Storage
  24. Index
  25. About the Authors
  26. Colophon
  27. Copyright