iOS 4 in Action
Examples and Solutions for iPhone & iPad
Jocelyn Harrington, Brandon Trebitowski, Christopher Allen, and Shannon Appelcline
  • June 2011
  • ISBN 9781617290015
  • 504 pages

The best iOS development book - and the first to feature Xcode 4!

Alex Curylo, Trollwerks Inc.


iOS 7 in Action is now available. An eBook of this older edition is included at no additional cost when you buy the revised edition!

Written for Xcode 4, iOS 4 in Action guides you from setting up your development environment, through coding your first app, all the way to selling in the App Store. Work through sample applications including a chat client, a video game, an interactive map, background audio, and more as you explore the iOS 4 SDK.

About the Technology

Version 4 of the iOS SDK adds powerful new features like multitasking, GCD, blocks, and iAds. With the release of Xcode 4, it's easier than ever to get programming, even if you're new to Objective-C.

About the book

iOS 4 in Action, written for Xcode 4, is a detailed, hands-on guide that goes from setting up your development environment, through your first coding steps, all the way to creating a polished, commercial iOS 4 application. You'll run through examples from a variety of areas including a chat client, a video game, an interactive map, and background audio. You'll also learn how the new iOS 4 features apply to your existing iOS 3 based apps. This book will help you become a confident, well-rounded iOS 4 developer.

Table of Contents detailed table of contents



about this book

about the cover illustration

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.4. Introducing iOS

1.5. iOS’s methods

1.6. How to make an application from an idea

1.7. Summary

2. Learning Objective-C

2.1. Introducing Objective-C

2.2. The message

2.3. Class definition

2.4. Properties

2.5. The @ directive

2.6. Categories and protocols

2.7. Wrapping up Objective-C

2.8. Summary

3. Using Xcode 4

3.1. Introducing Xcode 4

3.2. Using Xcode 4 to create the HelloWorld application

3.3. Closer look at files under the Navigation area

3.4. Using Interface Builder in Xcode 4

3.5. Summary

4. Xcode and debugging

4.1. Creating a new class in Xcode

4.2. Creating objects with Interface Builder

4.3. Debugger and Instruments

4.4. Summary

5. Basic view controllers

5.1. The view controller family

5.2. The standard view controller

5.3. The table view controller

5.4. Summary

6. Monitoring events and actions

6.1. An introduction to events

6.2. A touching example: the event reporter

6.3. Other event functionality

6.4. An introduction to actions

6.5. Adding a button to an application

6.6. Other action functionality

6.7. Introducing notifications

6.8. Summary

7. Advanced view controllers

7.1. The tab bar view controller

7.2. The navigation controller

7.3. Using the flipside controller

7.4. The split view controller

7.5. Popover and modal view controllers

7.6. Combining view controllers in universal applications

7.7. Summary

8. Data: actions, preferences, and files

8.1. Accepting user actions

8.2. Maintaining user preferences

8.3. Opening files

8.4. Summary

9. Data: advanced techniques

9.1. Using SQLite

9.2. Accessing the Address Book

9.3. An introduction to Core Data

9.4. Summary

10. Positioning: accelerometers, location, and the compass

10.1. The accelerometers and orientation

10.2. The accelerometers and movement

10.3. The accelerometers and gestures

10.4. All about Core Location

10.5. Summary

11. Media: images and the camera

11.1. An introduction to images

11.2. Drawing simple images with Core Graphics

11.3. Accessing photos

11.4. Collage: an image example

11.5. Printing images

11.6. Summary

12. Media: audio and recording

12.1. Playing audio from the iPod library

12.2. Recording audio

12.3. Playing sounds

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

12.5. Recording, playing, and accessing video

12.6. Summary

13. Graphics: Quartz, Core Animation, and OpenGL

13.1. An introduction to Quartz 2D

13.2. The Quartz context

13.3. Drawing paths

13.4. Setting the graphical state

13.5. Advanced drawing in Quartz

13.6. Drawing on a picture: an example

13.7. An introduction to Core Animation

13.8. An introduction to OpenGL

13.9. Summary

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.4. Using UIWebView

14.5. Parsing XML

14.6. POSTing to the web

14.7. Accessing the social web

14.8. Summary

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.3. Example: creating a multiplayer table tennis game

15.4. Summary

16. Using Event Kit on the iPhone and iPad

16.1. An overview of the Event Kit frameworks

16.2. Adding new events to Calendar programmatically

16.3. Creating an event with the Event Edit view controller

16.4. Fetching events

16.5. Fetching events with GCD

16.6. Summary

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.5. Creating a push notification provider in PHP

17.6. Summary

18. The Map Kit framework

18.1. Adding a map view to an application

18.2. Reverse geocoding

18.3. Annotating the map

18.4. Summary

19. In-app purchasing using Store Kit

19.1. Setting up a sandbox testing environment

19.2. Creating a simple store interface

19.3. Summary

20. Making money with iAd

20.1. Adding a banner ad into your application

20.2. Supporting both portrait mode and landscape mode

20.3. How to handle advertisement downloading errors

20.4. Going live with the application

20.5. Summary

21. Introducing multitasking

21.1. Overview of multitasking

21.2. Background state

21.3. Using fast app switching

21.4. Task completion in the background

21.5. Monitoring location changes in the background

21.6. Summary

22. Multitasking in depth

22.1. Using the location-monitoring service

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

22.3. Enabling audio playing in the background

22.4. Building the background audio application

22.5. Summary

Appendix A: iOS class reference

Appendix B: External sources and references

Appendix C: Publishing your application

Appendix D: Updating current applications for the iPad


What's inside

  • Full coverage of iOS SDK 4.3
  • Mastering Xcode 4
  • Multitasking for iPhone and iPad
  • Game Center, iAd, and AirPrint
  • Local and push notification
  • Implementing in-app purchasing

About the reader

No previous iPhone or iPad know-how needed. Familiarity with C, Cocoa , or Objective-C helps but is not required.

About the authors

Jocelyn Harrington is an experienced full-time mobile developer with a dozen entries in the App Store. Brandon Trebitowski, Christopher Allen, and Shannon Appelcline are the authors of the previous edition, iPhone and iPad in Action.

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks