Contents
Chapter 1: Application Recipes
Recipe 1-1: Setting Up a Single View Application
Recipe 1-2: Linking a Framework
Recipe 1-3: Adding a User Interface Control View
Recipe 1-4: Creating an Outlet
Recipe 1-5: Creating an Action
Recipe 1-7: Adding an Info.plist Property
Recipe 1-8: Adding a Resource File
Setting Up a Framework for Error Handling
Recipe 1-10: Handling Exceptions
A Strategy for Handling Exceptions
Intercepting Uncaught Exceptions
Recipe 1-11: Adding a Lite Version
Recipe 1-12: Adding Launch Images
So, What’s in a Story (board)?
Recipe 2-1: Implementing a Navigation Controller
Adding a New Scene to the Storyboard
Recipe 2-2: Implementing a UITableViewController
Setting Up a Custom View Controller
Recipe 2-3: Implementing a UITabBarController
Recipe 3-2: Programming Auto Layout
Defining the Image Views’ Constraints
Recipe 3-3: Debugging Auto Layout Code
Dealing with Ambiguous Layouts
Chapter 4: Table and Collection View Recipes
Recipe 4-1: Creating an Ungrouped Table
Displaying Data in a Table View
Considerations for Cached Cells and Reuse
Implementing the Accessory Views
Considerations for Cell View Customization
Recipe 4-2: Editing a UITableView
Recipe 4-3: Reordering a UITableView
Recipe 4-4: Creating a Grouped UITableView
Recipe 4-5: Registering a Custom Cell Class
Creating a Custom Table View Cell Class
Recipe 4-6: Creating a Flag Picker Collection View
Defining the Collection View Interface
Using Auto Layout to Center the Headers
Standard and Significant Change Services
Recipe 5-1: Getting Basic Location Information
Starting and Stopping Location Updates
Recipe 5-2: Significant Location Changes
Recipe 5-3: Tracking Magnetic Bearing
Starting and Stopping Heading Updates
Recipe 5-4: Tracking True Bearing
Recipe 5-6: Implementing Geocoding
Implementing Reverse Geocoding
Implementing Forward Geocoding
Recipe 6-1: Recognizing Shake Events
Implementing Shake Notifications
Recipe 6-2: Accessing Raw Core Motion Data
Recipe 6-3: Accessing Device Motion Data
Recipe 6-4: Moving a Label with Gravity
Recipe 7-1: Showing a Map with the Current Location
Recipe 7-2: Marking Locations with Pins
Recipe 7-3: Creating Custom Annotations
Creating a Custom Annotation Class
Creating a Custom Annotation View
Recipe 7-5: Adding Overlays to a Map
Recipe 7-6: Grouping Annotations Dynamically
Recipe 7-7: Starting Maps from Your App
Recipe 7-8: Registering a Routing App
Recipe 7-9: Getting Directions
Recipe 7-10: Using 3-D Mapping
Using the Convenience Method Approach
Chapter 8: Social Network Recipes
Recipe 8-1: Sharing Content with the Activity View
Setting Up an Activity View Controller
Recipe 8-2: Sharing Content Using a Compose View
Recipe 8-3: Sharing Content Using SLRequest
Requesting Access to Twitter Accounts
Setting Up a Navigation-Based Application
Saving Pictures to a Photos Album
Recipe 9-4: Using Custom Camera Overlays
Recipe 9-5: Displaying Camera Preview with AVCaptureSession
Recipe 9-6: Capturing Still Images with AVCaptureSession
Recipe 9-7: Capturing Video with AVCaptureSession
Recipe 9-8: Capturing Video Frames
Recipe 9-9: Capturing Machine-Readable Codes
Chapter 10: Multimedia Recipes
Handling Errors and Interruptions
Recipe 10-3: Accessing the Music Library
Setting Up a Basic Music Player
Recipe 10-4: Playing Background Audio
Declaring Background Mode Playback
Recipe 11-1: Using Image Views
Recipe 11-3: Manipulating Images with Filters
Creating Thumbnail Images for the Table View
Recipe 11-4: Detecting Features
Recipe 12-1: Drawing Simple Shapes
Recipe 12-3: Adding Fonts and Drawing Text
Recipe 12-5: Creating Gradients
Recipe 12-6: Clipping a Drawing to a Mask
Recipe 12-7: Programming Screen Shots
Chapter 13: Animation and Physics Recipes
Recipe 13-1. View Animation Using UIKit
Changing Size and Transparency
Handling Rotation and Chaining Animation
Recipe 13-2. Implementing UIKit Dynamics
Creating a Custom Behavior Class
Recipe 14-1. Working with NSCalendar and NSDate
Recipe 14-2. Fetching Calendar Events
Recipe 14-3. Displaying Events in a Table View
Recipe 14-4. Viewing, Editing, and Deleting Events
Recipe 14-5. Creating Calendar Events
Recipe 14-6. Creating Reminders
Requesting Access to Reminders
Creating Location-Based Reminders
Recipe 14-7. Accessing the Address Book
Recipe 14-8. Setting Contact Information
Chapter 15: Data Storage Recipes
Recipe 15-1. Persisting Data with NSUserDefaults
Recipe 15-2. Persisting Data Using Files
Setting Up the Vocabularies Table View
Implementing the Words View Controller
Recipe 15-4. Storing Key-Value Data in iCloud
Persisting Data in an iCloud Key-Value Store
Caching iCloud Data Locally Using NSUserDefaults
Recipe 15-5. Storing UIDocuments in iCloud
Chapter 16: Data Transmission Recipes
Recipe 16-1: Composing Text Messages
Recipe 16-3: Printing an Image
Recipe 16-4: Printing Plain Text
Recipe 16-6: Formatted Printing with Page Renderers
Recipe 17-1. Making Your App Game Center Aware
Registering with iTunes Connect
Displaying Game Center from Your App
Recipe 17-2. Implementing Leaderboards
Reporting Scores to Game Center
Recipe 17-3. Implementing Achievements
Defining Achievements in iTunes Connect
Recipe 17-4. Creating a Simple Turn-Based Multiplayer Game
Preparing the Game for Game Center