Contents

About the Authors

About the Technical Reviewer

Acknowledgments

Introduction

images 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-6: Creating a Class

Recipe 1-7: Adding an Info.plist Property

Recipe 1-8: Adding a Resource File

Recipe 1-9: Using Storyboards

So What’s in a Story(board)?

Setting Up the Application with a Storyboard

Adding a New Scene to the Storyboard

Adding a Table View Scene

Adding a Detail View

Setting Up a Custom View Controller

Using Cell Prototypes

Recipe 1-10: Handling Errors

Setting Up a Framework for Error Handling

Notifying the User

Implementing Recovery Options

Recipe 1-11: Handling Exceptions

A Strategy for Handling Exceptions

Setting Up a Test Application

Intercepting Uncaught Exceptions

Reporting Errors

Adding the Button

Emailing the Report

A Final Touch

Recipe 1-12: Adding a Lite Version

Adding a Build Target

Coding for a Specific Version

Recipe 1-13: Adding Launch Images

Launch Image Files

Designing Launch Images

Summary

images Chapter 2: Layout Recipes

Recipe 2-1: Using Autolayout

Autolayout Constraints

Constraint Priorities

Adding a Trailing Button

Recipe 2-2: Programming Autolayout

Setting Up the Application

The Visual Format Language

Adding Image Views

Defining the Image Views’ Constraints

Recipe 2-3: Debugging Autolayout

Dealing with Ambiguous Layouts

Handling Unsatisfiability

Summary

images Chapter 3: Table and Collection View Recipes

Recipe 3-1: Creating an Ungrouped Table

Setting Up the Application

Adding a Model for Countries

Displaying Data in a Table View

A Note on Cached Cells

Configuring the Cells

A Note on Rounded Corners

Implementing the Accessory Views

Enhanced User Interaction

A Note on Cell View Customization

Recipe 3-2: Editing a UITableView

UITableView Row Animations

But Wait, There’s More!

Recipe 3-3: Reordering a UITableView

Recipe 3-4: Creating a Grouped UITableView

Recipe 3-5: Registering a Custom Cell Class

Creating a Custom Table View Cell Class

Registering Your Cell Class

Recipe 3-6: Creating a Flag Picker Collection View

Setting Up the Application

Creating a Data Model

Building the Flag Picker

Defining the Collection View Interface

Displaying the Flag Picker

Using Autolayout to Center the Headers

Summary

images Chapter 4: Location Recipes

About Core Location

Standard and Significant Change Services

What’s New in iOS 6

Requiring Location Service

Recipe 4-1: Getting Basic Location Information

Setting Up the Application

Starting and Stopping Location Updates

Receiving Location Updates

Testing Location Updates

Recipe 4-2: Significant Location Changes

Setting Up the Application

Enabling Background Updates

Adding Local Notifications

Recipe 4-3: Tracking Magnetic Bearing

About Heading Tracking

Setting Up the Application

Starting and Stopping Heading Updates

Implementing Delegate Methods

Recipe 4-4: Tracking True Bearing

Adding True Bearing

Recipe 4-5: Region Monitoring

A Thing or Two About Regions

Welcome to Baltimore!

Recipe 4-6: Implementing Geocoding

Implementing Reverse Geocoding

Implementing Forward Geocoding

Best Practices

Summary

images Chapter 5: Motion Recipes

Recipe 5-1: Recognizing Shake Events

Intercepting Shake Events

Subclassing the Window

Implementing Shake Notifications

Testing Shake Events

Recipe 5-2: Accessing Raw Core Motion Data

The Core Motion Sensors

Setting Up the Project

Accessing Sensor Data

Pushing or Pulling

Selecting an Update Interval

The Nature of Raw Motion Data

Recipe 5-3: Accessing Device Motion Data

The Device Motion Class

Setting Up the Application

Accessing Device Motion Data

Setting a Reference Frame

Recipe 5-4: Moving a Label with Gravity

Setting Up the Application

Moving the Label with Gravity

Adding Acceleration

Summary

images Chapter 6: Map Recipes

Recipe 6-1: Showing a Map with the Current Location

Setting Up the Application

User-Controlled Tracking

Recipe 6-2: Marking Locations with Pins

Adding Annotation Objects

Changing the Pin Color

Recipe 6-3: Creating Custom Annotations

Setting Up the Application

Creating a Custom Annotation Class

Creating a Custom Annotation View

Customizing the Callouts

Adding a Detailed View

Recipe 6-4: Dragging a Pin

Adding a Draggable Pin

Recipe 6-5: Adding Overlays to a Map

Creating the Overlays

Recipe 6-6: Grouping Annotations Dynamically

A Forest of Pins

Implementing a Solution

Adding Color Coding

Recipe 6-7: Starting Maps from Your App

Adding Map Items

Launching in Directions Mode

Recipe 6-8: Registering a Routing App

Declaring a Routing App

Handling Launches

Testing the Routing App

Specifying Coverage Area

Summary

images Chapter 7: Social Network Recipes

Recipe 7-1: Sharing Content with the Activity View

Setting Up an Activity View Controller

Excluding Activity View Items

Including Activity View Items

Recipe 7-2: Sharing Content Using a Compose View

Recipe 7-3: Sharing Content Using SLRequest

Setting Up the Main View

Requesting Access to Twitter Accounts

Handling Multiple Accounts

Recipe 7-4: Retrieving Tweets

Setting Up a Navigation-Based Application

Displaying Available Feeds

Displaying Tweets

Showing Individual Tweets

Summary

images Chapter 8: Camera Recipes

Recipe 8-1: Taking Pictures

Setting Up the User Interface

Accessing the Camera

Retrieving a Picture

Implement Basic Editing

Saving Picture to Photos Album

Recipe 8-2: Recording Video

Recipe 8-3: Editing Videos

Recipe 8-4: Using Custom Camera Overlays

Recipe 8-5: Displaying Camera Preview with AVCaptureSession

Recipe 8-6: Capturing Still Images with AVCaptureSession

Adding a Capture Button

Recipe 8-7: Capturing Video with AVCaptureSession

Adding a Video Recording Mode

Recipe 8-8: Capturing Video Frames

Summary

images Chapter 9: Multimedia Recipes

Recipe 9-1: Playing Audio

Setting Up the Application

Setting Up the Audio Player

Handling Errors and Interruptions

Recipe 9-2: Recording Audio

Setting Up an Audio Recorder

Handling Interruptions

Recipe 9-3: Accessing the Music Library

Setting Up a Basic Music Player

Handling Notifications

Picking Media to Play

Querying Media

Recipe 9-4: Playing Background Audio

Setting Up the User Interface

Declaring Background Mode Playback

Implementing the Player

Summary

images Chapter 10: Image Recipes

Recipe 10-1: Drawing Simple Shapes

Recipe 10-2: Programming Screenshots

Recipe 10-3: Using Image Views

Recipe 10-4: Scaling Images

In Review

Recipe 10-5: Manipulating Images with Filters

Combining Filters

Creating Thumbnail Images for the Table View

Recipe 10-6: Detecting Features

Summary

images Chapter 11: User Data Recipes

Recipe 11-1: Working with NSCalendar and NSDate

Recipe 11-2: Fetching Calendar Events

Recipe 11-3: Displaying Events in a Table View

Recipe 11-4: Viewing, Editing, and Deleting Events

Recipe 11-5: Creating Calendar Events

Creating Recurring Events

Recipe 11-6: Creating Reminders

Setting Up the Application

Requesting Access to Reminders

Creating Time-Based Reminders

Creating Location-Based Reminders

Recipe 11-7: Accessing the Address Book

Recipe 11-8: Setting Contact Information

Summary

images Chapter 12: Data Storage Recipes

Recipe 12-1: Persisting Data With NSUserDefaults

Recipe 12-2: Persisting Data Using Files

Recipe 12-3: Using Core Data

Understanding Core Data

Setting Up Core Data

Designing the Data Model

Setting Up the Vocabularies Table View

Implementing the Words View Controller

Adding a Word Edit View

Persisting Data on iCloud

Recipe 12-4: Storing Key-Value Data in iCloud

Setting Up iCloud For an App

Persisting Data in iCloud Key-Value Store

Caching iCloud Data Locally Using NSUserDefaults

Recipe 12-5: Storing UIDocuments in iCloud

Summary

images Chapter 13: Data Transmission Recipes

Recipe 13-1: Composing Text Messages

Recipe 13-2: Composing Email

Attaching Data to Mail

Recipe 13-3: Printing an Image

Recipe 13-4: Printing Plain Text

Recipe 13-5: Printing a View

Recipe 13-6: Formatted Printing with Page Renderers

Summary

images Chapter 14: Game Kit Recipes

Recipe 14-1: Making Your App Game Center Aware

Implementing the Game

Registering with iTunes Connect

Authenticating Local Player

Displaying Game Center From Your App

Recipe 14-2: Implementing Leaderboards

Defining the Leaderboards

Reporting Scores to Game Center

Recipe 14-3: Implementing Achievements

Defining Achievements in iTunes Connect

Reporting the Achievements

Recipe 14-4: Creating a Simple Turn-Based Multiplayer Game

Building the Tic Tac Toe Game

Preparing the Game for Game Center

Implementing Matchmaking

Encoding and Decoding Match Data

Handling Turn-Based Events

Summary

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset