Contents

About the Authors

About the Technical Reviewer

Acknowledgments

Introduction

images Chapter 1: Welcome to the Jungle

What this Book Is

What You Need

Developer Options

What You Need to Know

What’s Different About Coding for iOS?

Only One Active Application

Only One Window

Limited Access

Limited Response Time

Limited Screen Size

Limited System Resources

No Garbage Collection, but . . . 

Some New Stuff

A Different Approach

What’s in This Book

What’s New in this Update?

Are You Ready?

images Chapter 2: Appeasing the Tiki Gods

Setting Up Your Project in Xcode

The Xcode Project Window

A Closer Look at Our Project

Introducing Xcode’s Interface Builder

File Formats

The Storyboard

The Library

Adding a Label to the View

Changing Attributes

Some iPhone Polish—Finishing Touches

Bring It on Home

images Chapter 3: Handling Basic Interaction

The Model-View-Controller Paradigm

Creating Our Project

Looking at the View Controller

Understanding Outlets and Actions

Cleaning Up the View Controller

Designing the User Interface

Trying It Out

Adding Some style

Looking at the Application Delegate

Bring It on Home

images Chapter 4: More User Interface Fun

A Screen Full of Controls

Active, Static, and Passive Controls

Creating the Application

Implementing the Image View and Text Fields

Adding the Image View

Resizing the Image View

Setting View Attributes

Adding the Text Fields

Creating and Connecting Outlets

Closing the Keyboard

Closing the Keyboard When Done Is Tapped

Touching the Background to Close the Keyboard

Adding the Slider and Label

Adding Constraints

Creating and Connecting the Actions and Outlets

Implementing the Action Method

Implementing the Switches, Button, and Segmented Control

Adding Two Labeled Switches

Connecting and Creating Outlets and Actions

Implementing the Switch Actions

Spiffing Up the Button

Stretchable Images

Control States

Connecting and Creating the Button Outlets and Actions

Implementing the Segmented Control Action

Implementing the Action Sheet and Alert

Conforming to the Action Sheet Delegate Method

Showing the Action Sheet

One Last Tweak

Crossing the Finish Line

images Chapter 5: Autorotation and Autosizing

The Mechanics of Autorotation

Points, Pixels, and the Retina Display

Autorotation Approaches

Choosing Your View Orientations

Supported Orientations at the App Level

Per-Controller Rotation Support

Designing an Interface Using Constraints

Overriding Default Constraints

Full-Width Labels

Restructuring a View When Rotated

Creating and Connecting Outlets

Moving the Views on Rotation

Rotating Out of Here

images Chapter 6: Multiview Applications

Common Types of Multiview Apps

The Architecture of a Multiview Application

The Root Controller

Anatomy of a Content View

Building View Switcher

Creating Our View Controller and Storyboard

Modifying the App Delegate

Modifying BIDSwitchViewController.m

Adding a View Controller

Building a View with a Toolbar

Writing the Root View Controller

Implementing the Content Views

Animating the Transition

Switching Off

images Chapter 7: Tab Bars and Pickers

The Pickers Application

Delegates and Data Sources

Creating the Pickers Application

Creating the View Controllers

Adding the Storyboard

Creating the Tab Bar Controller

The Initial Test Run

Implementing the Date Picker

Implementing the Single-Component Picker

Building the View

Implementing the Controller as a Data Source and Delegate

Implementing a Multicomponent Picker

Declaring Outlets and Actions

Building the View

Implementing the Controller

Implementing Dependent Components

Creating a Simple Game with a Custom Picker

Writing the Controller Header File

Building the View

Adding Image Resources

Implementing the Controller

Final Details

Final Spin

images Chapter 8: Introduction to Table Views

Table View Basics

Table Views and Table View Cells

Grouped and Plain Tables

Implementing a Simple Table

Designing the View

Writing the Controller

Adding an Image

Using Table View Cell Styles

Setting the Indent Level

Handling Row Selection

Changing the Font Size and Row Height

Customizing Table View Cells

Adding Subviews to the Table View Cell

Creating a UITableViewCell Subclass

Loading a UITableViewCell from a Nib

Grouped and Indexed Sections

Building the View

Importing the Data

Implementing the Controller

Adding an Index

Reducing Status Bar Interference

Implementing a Search Bar

Putting It All on the Table

images Chapter 9: Navigation Controllers and Table Views

Navigation Controller Basics

Stacky Goodness

A Stack of Controllers

Fonts, a Simple Font Browser

Meet the Subcontrollers

The Fonts Application’s Skeleton

Creating the Root View Controller

Initial Storyboard Setup

First Subcontroller: The Font List View

Storyboarding the Font List

Making the Root View Controller Prepare for Segues

Creating the Font Sizes View Controller

Storyboarding the Font Sizes View Controller

Making the Font List View Controller Prepare for Segues

Creating the Font Info View Controller

Storyboarding the Font Info View Controller

Setting up Constraints

Adapting Font List View Controller for Multiple Segues

My Favorite Fonts

Table View Niceties

Implementing Swipe-to-Delete

Implementing Drag-to-Reorder

Breaking the Tape

images Chapter 10: Collection View

Creating the DialogViewer Project

Fixing the View Controller’s Class

Defining Custom Cells

Configuring the View Controller

Providing Content Cells

Making the Layout Flow

Providing Header Views

images Chapter 11: iPad Considerations

Split Views and Popovers

Creating a Split View Project

The Storyboard Defines the Structure

The Code Defines the Functionality

Here Come the Presidents

Creating Your Own Popover

iPad Wrap-Up

images Chapter 12: Application Settings and User Defaults

Getting to Know Your Settings Bundle

The Bridge Control Application

Creating the Project

Working with the Settings Bundle

Reading Settings in Our Application

Changing Defaults from Our Application

Registering Default Values

Keeping It Real

Beam Me Up, Scotty

images Chapter 13: Basic Data Persistence

Your Application’s Sandbox

Getting the Documents Directory

Getting the tmp Directory

File-Saving Strategies

Single-File Persistence

Multiple-File Persistence

Using Property Lists

Property List Serialization

The First Version of the Persistence Application

Archiving Model Objects

Conforming to NSCoding

Implementing NSCopying

Archiving and Unarchiving Data Objects

The Archiving Application

Using iOS’s Embedded SQLite3

Creating or Opening the Database

Using Bind Variables

The SQLite3 Application

Using Core Data

Entities and Managed Objects

The Core Data Application

Persistence Rewarded

images Chapter 14: Documents and iCloud

Managing Document Storage With UIDocument

Building TinyPix

Creating BIDTinyPixDocument

Code Master

Initial Storyboarding

Creating BIDTinyPixView

Storyboard Detailing

Adding iCloud Support

Creating a Provisioning Profile

How to Query

Save Where?

Storing Preferences on iCloud

What We Didn’t Cover

images Chapter 15: Grand Central Dispatch, Background Processing, and You

Grand Central Dispatch

Introducing SlowWorker

Threading Basics

Units of Work

GCD: Low-Level Queuing

Becoming a Blockhead

Improving SlowWorker

Background Processing

Application Life Cycle

State-Change Notifications

Creating State Lab

Exploring Execution States

Using Execution State Changes

Handling the Inactive State

Handling the Background State

Grand Central Dispatch, Over and Out

images Chapter 16: Drawing with Core Graphics

Paint the World

The Quartz 2D Approach to Drawing

Quartz 2D’s Graphics Contexts

The Coordinate System

Specifying Colors

Drawing Images in Context

Drawing Shapes: Polygons, Lines, and Curves

Quartz 2D Tool Sampler: Patterns, Gradients, and Dash Patterns

The QuartzFun Application

Setting Up the QuartzFun Application

Adding Quartz 2D Drawing Code

Optimizing the QuartzFun Application

Drawing to a Close

images Chapter 17: Getting Started with Sprite Kit

Simple Beginnings

Initial Scene Customization

Hiding the Status Bar

Scene Setup

Player Movement

Adding the Player to the Scene

Handling Touches

Player Movement

Geometry Calculations

Wobbly Bits

Creating Your Enemies

Putting Enemies in the Scene

Start Shooting

Defining Your Physics Categories

Creating the BIDBulletNode class

Applying Physics

Adding Bullets to the Scene

Attacking Enemies with Physics

Finishing Levels

Keeping Tabs on the Enemies

Transitioning to the Next Levels

Customizing Collisions

Adding a Category to SKNode

Adding Custom Collision Behavior to Enemies

Showing Accurate Player Lives

Spicing Things up with Particles

Your First Particle

Putting Particles into the Scene

The End Game

At last, a Beginning (Create a StartScene)

A Sound is Worth a Thousand Pictures

Game On

images Chapter 18: Taps, Touches, and Gestures

Multitouch Terminology

The Responder Chain

Responding to Events

Forwarding an Event: Keeping the Responder Chain Alive

The Multitouch Architecture

The Four Touch Notification Methods

The TouchExplorer Application

The Swipes Application

Automatic Gesture Recognition

Implementing Multiple Swipes

Detecting Multiple Taps

Detecting Pinch and Rotation

Defining Custom Gestures

The CheckPlease Application

The CheckPlease Touch Methods

Garçon? Check, Please!

images Chapter 19: Where Am I? Finding Your Way with Core Location and Map Kit

The Location Manager

Setting the Desired Accuracy

Setting the Distance Filter

Starting the Location Manager

Using the Location Manager Wisely

The Location Manager Delegate

Getting Location Updates

Getting Latitude and Longitude Using CLLocation

Error Notifications

Trying Out Core Location

Updating Location Manager

Visualizing your Movement on a Map

Wherever You Go, There You Are

images Chapter 20: Whee! Gyro and Accelerometer!

Accelerometer Physics

Don’t Forget Rotation

Core Motion and the Motion Manager

Event-Based Motion

Proactive Motion Access

Accelerometer Results

Detecting Shakes

Baked-In Shaking

Shake and Break

Accelerometer As Directional Controller

Rolling Marbles

Writing the Ball View

Calculating Ball Movement

Rolling On

images Chapter 21: The Camera and Photo Library

Using the Image Picker and UIImagePickerController

Implementing the Image Picker Controller Delegate

Road Testing the Camera and Library

Designing the Interface

Implementing the Camera View Controller

It’s a Snap!

images Chapter 22: Application Localization

Localization Architecture

Strings Files

What’s in a Strings File?

The Localized String Macro

Real-World iOS: Localizing Your Application

Setting Up LocalizeMe

Trying Out LocalizeMe

Localizing the Project

Localizing the Storyboard

Generating and Localizing a Strings File

Localizing the App Display Name

Auf Wiedersehen

Index

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

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