Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Praise for the previous edition iPhone and iPad in Action

Preface

Acknowledgments

About this Book

About the Cover Illustration

Chapter 1. Introducing iOS 4 with iPhone and iPad

1.1. All for one and one for all: the iOS platform

1.2. Understanding iPhone and iPad touch interaction

1.3. Getting ready for the SDK

1.3.1. Installing the SDK

1.3.2. The anatomy of the SDK

1.4. Introducing iOS

1.4.1. The anatomy of iOS

1.4.2. The object hierarchy of iOS

1.4.3. Windows and views

1.5. iOS’s methods

1.5.1. Object creation

1.5.2. Memory management

1.5.3. Event response

1.5.4. Lifecycle management

1.6. How to make an application from an idea

1.6.1. The checklist

1.6.2. What’s the category for your application?

1.6.3. Making money with your application

1.7. Summary

Chapter 2. Learning Objective-C

2.1. Introducing Objective-C

2.2. The message

2.2.1. Messages with arguments

2.2.2. Nested messages

2.2.3. Message recipients

2.3. Class definition

2.3.1. The interface

2.3.2. The implementation

2.3.3. Object instantiation

2.4. Properties

2.4.1. The purpose of properties

2.4.2. Setting a property

2.4.3. Using the accessors

2.4.4. The dot syntax

2.4.5. Property complexities

2.5. The @ directive

2.6. Categories and protocols

2.6.1. The category

2.6.2. The protocol

2.7. Wrapping up Objective-C

2.8. Summary

Chapter 3. Using Xcode 4

3.1. Introducing Xcode 4

3.2. Using Xcode 4 to create the HelloWorld application

3.2.1. Creating a new project

3.2.2. Getting familiar with the workspace window

3.3. Closer look at files under the Navigation area

3.3.1. HelloWorld folder

3.3.2. Frameworks folder and Product folder

3.3.3. Building and running an application in Xcode

3.3.4. Writing code for HelloWorld

3.4. Using Interface Builder in Xcode 4

3.4.1. The anatomy of Interface Builder

3.4.2. Building the AppleStock application

3.5. Summary

Chapter 4. Xcode and debugging

4.1. Creating a new class in Xcode

4.1.1. Creating a new class

4.1.2. The header file

4.1.3. The source code file

4.1.4. Linking it in

4.2. Creating objects with Interface Builder

4.2.1. Creating new nib files

4.2.2. Initializing Interface Builder objects

4.2.3. Accessing .xib files

4.2.4. More tips under Xcode

4.3. Debugger and Instruments

4.3.1. Fix-it function

4.3.2. Analyze

4.3.3. Debugger essentials

4.3.4. Running Instruments from Xcodeb

4.4. Summary

Chapter 5. Basic view controllers

5.1. The view controller family

5.2. The standard view controller

5.2.1. The anatomy of a view controller

5.2.2. Creating a view controller

5.2.3. Creating another view controller

5.2.4. Building up a view controller interface

5.2.5. Using your view controller

5.3. The table view controller

5.3.1. The anatomy of a table view controller

5.3.2. Creating a table view controller

5.3.3. Building up a table interface

5.3.4. Using your table view controller

5.4. Summary

Chapter 6. Monitoring events and actions

6.1. An introduction to events

6.1.1. The responder chain

6.1.2. Touches and events

6.2. A touching example: the event reporter

6.2.1. Setting things up in Interface Builder

6.2.2. Preparing a view for touches

6.2.3. Controlling your events

6.3. Other event functionality

6.3.1. Regulating events

6.3.2. Other event methods and properties

6.4. An introduction to actions

6.4.1. The UIControl object

6.4.2. Control events and actions

6.4.3. Using addTarget:action:forControlEvents:

6.5. Adding a button to an application

6.5.1. Using addTarget:action:forControlEvents: with a button

6.5.2. Using an IBAction with a button

6.6. Other action functionality

6.6.1. Accepting text input with UITextField

6.6.2. Allowing value selection with UISlider

6.6.3. A TextField/Slider mashup

6.6.4. Actions made easy

6.6.5. Actions in use

6.7. Introducing notifications

6.8. Summary

Chapter 7. Advanced view controllers

7.1. The tab bar view controller

7.1.1. The anatomy of a tab bar view controller

7.1.2. Creating a tab bar view controller

7.1.3. Building a tab bar interface

7.1.4. Using your tab bar controller

7.2. The navigation controller

7.2.1. The anatomy of a navigation controller

7.2.2. Creating a navigation controller

7.2.3. Completing the navigation controller

7.2.4. Using your navigation controller

7.3. Using the flipside controller

7.4. The split view controller

7.4.1. Creating a split view controller

7.4.2. Building the split view controller

7.4.3. Using your split view controller

7.4.4. Adjusting the interface for vertical and landscape modes

7.5. Popover and modal view controllers

7.5.1. Creating a popover view controller

7.5.2. Creating a modal view controller

7.6. Combining view controllers in universal applications

7.6.1. Design universal applications for the iPhone and iPad

7.6.2. Combining view controllers

7.7. Summary

Chapter 8. Data: actions, preferences, and files

8.1. Accepting user actions

8.2. Maintaining user preferences

8.2.1. Creating your own preferences

8.2.2. Using the system settings

8.3. Opening files

8.3.1. Accessing your bundle

8.3.2. Accessing other directories

8.3.3. Manipulating files

8.3.4. Filesaver: a UITextView example

8.4. Summary

Chapter 9. Data: advanced techniques

9.1. Using SQLite

9.1.1. Setting up an SQLite database

9.1.2. Accessing SQLite

9.1.3. Accessing your SQLite database

9.1.4. Building a navigation menu from a database

9.1.5. Expanding this example

9.2. Accessing the Address Book

9.2.1. An overview of the frameworks

9.2.2. Accessing Address Book properties

9.2.3. Querying the Address Book

9.2.4. Using the Address Book UI

9.3. An introduction to Core Data

9.3.1. Background information about Core Data

9.3.2. Setting up Core Data in your application

9.3.3. Initializing the Core Data objects

9.3.4. Adding objects to the database

9.3.5. Fetching, updating, and deleting objects in Core Data

9.4. Summary

Chapter 10. Positioning: accelerometers, location, and the compass

10.1. The accelerometers and orientation

10.1.1. The orientation property

10.1.2. The orientation notification

10.2. The accelerometers and movement

10.2.1. Accessing the UIAccelerometer

10.2.2. Parsing the UIAcceleration

10.2.3. Checking for gravity

10.2.4. Checking for movement

10.2.5. Recognizing simple accelerometer movement

10.3. The accelerometers and gestures

10.3.1. Using accelerometers

10.3.2. Gesture recognizer

10.4. All about Core Location

10.4.1. The location classes

10.4.2. An example using location and distance

10.4.3. An example using altitude

10.4.4. Using the compass

10.4.5. Retrieving data from the compass

10.4.6. Core Location and the internet

10.5. Summary

Chapter 11. Media: images and the camera

11.1. An introduction to images

11.1.1. Loading a UIImage

11.1.2. Drawing a UIImageView

11.1.3. Modifying an image in UIKit

11.2. Drawing simple images with Core Graphics

11.3. Accessing photos

11.3.1. Using the image picker

11.3.2. Taking photos

11.3.3. Saving to the photo album

11.4. Collage: an image example

11.4.1. The collage view controller

11.4.2. The collage temporary image view

11.4.3. The collage view

11.4.4. Further exploration of this example

11.5. Printing images

11.5.1. Printing workflow

11.5.2. Simulating printing

11.5.3. Creating a demo app-printing image

11.5.4. Launching the printer app on the Simulator

11.6. Summary

Chapter 12. Media: audio and recording

12.1. Playing audio from the iPod library

12.1.1. Retrieving audio items from the iPod media library

12.1.2. Getting information about an MPMediaItem

12.1.3. Playing media items using MPMusicPlayerController

12.1.4. Example: creating a simple media player application

12.2. Recording audio

12.2.1. Initializing the audio recorder

12.2.2. Controlling the audio recorder

12.2.3. Responding to AVAudioRecorder events

12.3. Playing sounds

12.3.1. Initializing the AVAudioPlayer

12.3.2. The AVAudioPlayerDelegate

12.3.3. Controlling the AVAudioPlayer

12.4. Example: creating a simple audio recording/playback application

12.4.1. Creating a view-based application

12.4.2. Adding the needed frameworks

12.4.3. Setting up the IBActions

12.4.4. Creating the interface

12.4.5. Setting up the audio recorder and implementing the IBActions

12.5. Recording, playing, and accessing video

12.6. Summary

Chapter 13. Graphics: Quartz, Core Animation, and OpenGL

13.1. An introduction to Quartz 2D

13.2. The Quartz context

13.2.1. Drawing to a UIView

13.2.2. Drawing to a bitmap

13.3. Drawing paths

13.3.1. Finishing a path

13.3.2. Drawing rectangles

13.4. Setting the graphical state

13.4.1. Setting colors

13.4.2. Making transformations

13.4.3. Setting clipping paths

13.4.4. Other settings

13.4.5. Managing the state

13.5. Advanced drawing in Quartz

13.5.1. Drawing gradients

13.5.2. Drawing images

13.5.3. Drawing words

13.5.4. What we didn’t cover

13.6. Drawing on a picture: an example

13.6.1. The PhotoDraw view controller

13.6.2. The photodraw view

13.6.3. Expanding on the example

13.7. An introduction to Core Animation

13.7.1. The fundamentals of Core Animation

13.7.2. Getting started with Core Animation

13.7.3. Drawing a simple implicit animation

13.7.4. Drawing a simple explicit animation

13.8. An introduction to OpenGL

13.9. Summary

Chapter 14. The web: web views and internet protocols

14.1. The hierarchy of the internet

14.2. Low-level networking

14.3. Working with URLs

14.3.1. Creating an NSURL

14.3.2. Building an NSURLRequest

14.3.3. Manipulating HTML data by hand

14.4. Using UIWebView

14.4.1. Calling up the web view

14.4.2. Managing the web view delegate

14.4.3. Thumbnails: a web view example

14.5. Parsing XML

14.5.1. Starting up NSXMLParser

14.5.2. Acting as a delegate

14.5.3. Building a sample RSS reader

14.5.4. Altitude redux: a Core Location example

14.6. POSTing to the web

14.6.1. POSTing by hand

14.6.2. Submitting forms

14.7. Accessing the social web

14.7.1. Using web protocols

14.7.2. Using TouchJSON

14.8. Summary

Chapter 15. Peer-to-peer connections using Game Kit

15.1. Overview of Game Kit

15.2. Creating peer-to-peer applications using the peer picker

15.2.1. Using Apple’s built-in peer picker

15.2.2. Implementing the GKSessionDelegate methods

15.2.3. Sending and receiving data between peers

15.3. Example: creating a multiplayer table tennis game

15.3.1. Starting the GKTennis project

15.3.2. Creating the header file

15.3.3. Creating the table tennis interface

15.3.4. Game initialization

15.3.5. Setting up the peer picker and getting connected

15.3.6. Implementing the send and receive methods

15.3.7. The game loop

15.3.8. User interaction

15.4. Summary

Chapter 16. Using Event Kit on the iPhone and iPad

16.1. An overview of the Event Kit frameworks

16.1.1. Adding Event Kit frameworks to your project

16.1.2. Event Kit classes

16.2. Adding new events to Calendar programmatically

16.2.1. Adding Event Kit frameworks to the Birthday application

16.2.2. Adding an event to Calendar

16.3. Creating an event with the Event Edit view controller

16.4. Fetching events

16.4.1. Fetching events with the predicate

16.4.2. Displaying events with Event view controller

16.5. Fetching events with GCD

16.5.1. Grand Central Dispatch overview

16.5.2. Fetching events with GCD

16.6. Summary

Chapter 17. Local and Push notification services

17.1. What are local and push notifications?

17.2. Implementing local notifications on Timer application

17.3. An overview of Apple’s push notification system

17.4. Preparing your application to use push notifications

17.4.1. Setting up your application certificate

17.4.2. Setting up your provisioning profile

17.4.3. The code for handling push notifications

17.4.4. Preparing audio files

17.5. Creating a push notification provider in PHP

17.5.1. Creating the SSL certificate

17.5.2. Implementing the PHP push notification provider

17.6. Summary

Chapter 18. The Map Kit framework

18.1. Adding a map view to an application

18.1.1. Adding the map using Interface Builder

18.1.2. Adding the map view programmatically

18.1.3. Controlling the map

18.2. Reverse geocoding

18.3. Annotating the map

18.3.1. Adding basic map annotations

18.3.2. Adding custom map annotations

18.4. Summary

Chapter 19. In-app purchasing using Store Kit

19.1. Setting up a sandbox testing environment

19.1.1. Creating an iTunes test user

19.1.2. Adding products

19.2. Creating a simple store interface

19.2.1. Creating the demo app

19.2.2. Adding Store Kit interface

19.2.3. Creating individual wallpaper product

19.2.4. Store Kit Payment

19.3. Summary

Chapter 20. Making money with iAd

20.1. Adding a banner ad into your application

20.1.1. Creating a simple app for the ad banner view

20.1.2. Adding the banner view to the view controller

20.2. Supporting both portrait mode and landscape mode

20.3. How to handle advertisement downloading errors

20.3.1. Adding a delegate to ADBannerView’s view controller

20.3.2. Simulating event handling

20.4. Going live with the application

20.5. Summary

Chapter 21. Introducing multitasking

21.1. Overview of multitasking

21.1.1. Application lifecycle

21.1.2. How to enable multitasking

21.2. Background state

21.2.1. Understanding the background state

21.2.2. Opting out of the background state

21.3. Using fast app switching

21.3.1. Building a simple application for fast app switching

21.3.2. Updating the user interface in the view controller

21.4. Task completion in the background

21.4.1. Task-completion API

21.4.2. Finishing a task in the background

21.5. Monitoring location changes in the background

21.5.1. An overview of the location service in the background

21.5.2. Monitoring significant location change

21.5.3. Monitoring region-based location change

21.6. Summary

Chapter 22. Multitasking in depth

22.1. Using the location-monitoring service

22.1.1. Updating the UI when the app relaunches

22.1.2. Enabling the significant-change location service

22.2. Building an audio-playing application with the Audio Toolbox framework

22.3. Enabling audio playing in the background

22.3.1. Adding the UIBackgroundModes in Info.plist

22.3.2. Handling the remote-control events

22.4. Building the background audio application

22.5. Summary

Appendix A. iOS class reference

A.1. UIKit framework classes

A.2. Foundation framework classes

A.3. Other classes

Appendix B. External sources and references

General resources

SDK resources

Other technologies

Appendix C. Publishing your application

C.1. Signing up with Apple

C.2. Compiling to the device

Warning

C.3. Preparing for distribution via the App Store

Appendix D. Updating current applications for the iPad

D.1. Configuring Xcode

D.2. Updating Info.plist to support multiple orientations

D.3. Adding iPad-specific interface components

D.4. Updating your views for the iPad

D.5. Adding multiple-orientation support

Index

List of Figures

List of Tables

List of Listings

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

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