iPhone in Action
Introduction to Web and SDK Development
Christopher Allen and Shannon Appelcline
  • December 2008
  • ISBN 9781933988863
  • 472 pages
  • printed in black & white
This title is out of print and no longer for sale.

The entry to the world of iPhone.

Aiden Montgomery, Wile Ltd.

Revised edition of this book is available

iPhone in Action is an in-depth introduction to both native and web programming for the iPhone. You'll learn how to turn your web pages into compelling iPhone web apps using WebKit, iUI, and Canvas. The authors also take you step by step into more complex Objective-C programming. They help you master the iPhone SDK including its UI and features like accelerometers, GPS, the Address Book, SQLite, and many more. Using Apple's standard tools like Dashcode, Xcode, and Interface Builder, you'll learn how to best use both approaches: iPhone web and SDK programming.

Table of Contents detailed table of contents



about this book

Part 1 Introducing iPhone programming

1. Introducing the iPhone

1.1. iPhone core specifications

1.2. How the iPhone compares to the industry

1.3. How the iPhone is unique

1.4. Understanding iPhone input and output

1.5. Summary

2. Web development or the SDK?

2.1. Comparing the two programming styles

2.2. A central philosophy: the continuum of programming

2.3. Advantages and disadvantages

2.4. Stand-alone iPhone development

2.5. Integrated iPhone development

2.6. Summary

Part 2 Designing web pages for the iPhone

3. Redeveloping web pages for the iPhone

3.1. The iPhone viewport

3.2. Making your web pages iPhone friendly

3.3. Making your web pages iPhone optimized

3.4. Manipulating iPhone chrome

3.5. Capturing iPhone events

3.6. Redisplaying web pages

3.7. Supporting non-iPhone users

3.8. Summary

4. Advanced WebKit and textual web apps

4.1. Introducing the WebKit

4.2. CSS transforms, transitions, and animations

4.3. The WebKit database

4.4. Adjusting the chrome

4.5. Recognizing touches and gestures

4.6. Recognizing orientation

4.7. Upcoming features: CSS gradients and masks

4.8. Summary

5. Using iUI for web apps

5.1. Creating your own iPhone UI

5.2. Getting ready for iUI

5.3. Developing with iUI

5.4. Creating an iUI back end

5.5. Other iUI tips and tricks

5.6. Integrating iUI with other libraries

5.7. Summary

6. Using Canvas for web apps

6.1. Getting ready for Canvas

6.2. Drawing paths

6.3. Drawing shapes

6.4. Creating styles: colors, gradients, and lines

6.5. Modifying composition and clipping

6.6. Transforming and restoring

6.7. Incorporating images, patterns, and text

6.8. Putting it together

6.9. Applying animation

6.10. Summary

7. Building web apps with Dashcode

7.1. An introduction to Dashcode

7.2. Writing Dashcode programs

7.3. Integrating Dashcode with existing libraries

7.4. Summary

8. Debugging iPhone web pages

8.1. Using Apache locally

8.2. Debugging with your desktop browser

8.3. Debugging with your iPhone

8.4. Profiling for the iPhone

8.5. Summary

9. SDK programming for web developers

9.1. An introduction to C���s concepts

9.2. An introduction to object-oriented programming

9.3. The Model-View-Controller (MVC) pattern

9.4. Summary

Part 3 Learning SDK fundamentals

10. Learning Objective-C and the iPhone OS

10.1. Getting ready for the SDK

10.2. Introducing Objective-C

10.3. Introducing the iPhone OS

10.4. The iPhone OS���s methods

10.5. Summary

11. Using Xcode

11.1. Introducing Xcode

11.2. Creating a first project in Xcode: Hello, World!

11.3. Creating a new class in Xcode

11.4. Other Xcode functionality

11.5. Summary

12. Using Interface Builder

12.1. An introduction to Interface Builder

12.2. Creating a first project in Interface Builder: pictures and the web

12.3. Building connections in Interface Builder

12.4. Other Interface Builder functionality

12.5. Summary

13. Creating basic view controllers

13.1. The view controller family

13.2. The bare view controller

13.3. The table view controller

13.4. Summary

14. Monitoring events and actions

14.1. An introduction to events

14.2. A touching example: the event reporter

14.3. Other event functionality

14.4. An introduction to actions

14.5. Adding a button to an application

14.6. Other action functionality

14.7. Introducing notifications

14.8. Summary

15. Creating advanced view controllers

15.1. The tab bar view controller

15.2. The navigation controller

15.3. Using the flipside controller

15.4. Modal view controllers

15.5. Summary

Part 4 Programming with the SDK Toolkit

16. Data: actions, preferences, files, SQLite, and addresses

16.1. Accepting user actions

16.2. Maintaining user preferences

16.3. Opening files

16.4. Using SQLite

16.5. Accessing the Address Book

16.6. Summary

17. Positioning: accelerometers and location

17.1. The accelerometer and orientation

17.2. The accelerometer and movement

17.3. The accelerometer and gestures

17.4. All about Core Location

17.5. Summary

18. Media: images and sounds

18.1. An introduction to images

18.2. Drawing simple images with Core Graphics

18.3. Accessing photos

18.4. Collage: an image example

18.5. Using the Media Player framework

18.6. Playing sounds manually

18.7. Summary

19. Graphics: Quartz, Core Animation, and OpenGL

19.1. An introduction to Quartz 2D

19.2. The Quartz context

19.3. Drawing paths

19.4. Setting the graphic state

19.5. Advanced drawing in Quartz

19.6. Drawing on a picture: an example

19.7. An introduction to Core Animation

19.8. An introduction to OpenGL

19.9. Summary

20. The web: web views and internet protocols

20.1. The hierarchy of the internet

20.2. Low-level networking

20.3. Working with URLs

20.4. Using UIWebView

20.5. Parsing XML

20.6. POSTing to the web

20.7. Accessing the social web

20.8. Summary

Appendix A: iPhone OS class reference

Appendix B: External sources and references

Appendix C: Publishing your SDK program


About the Technology

The iPhone explodes old ideas of a cell phone. Its native SDK offers a remarkable range of features including easy-to-build graphical objects, a unique navigation system, and a built-in database, all on a location-knowledgeable device. Websites and web apps can now behave like native iPhone apps, with great network integration.

What's inside

  • A comprehensive tutorial for iPhone programming
  • Web development, the SDK, and hybrid coding
  • Over 60 web, Dashcode, and SDK examples

About the reader

This book is intended as an introduction to its topics. Proficiency with C, Cocoa, or Objective-C is helpful but not required.

About the authors

Christopher Allen is one of the leaders of the iPhone Web Developer community. He is the host of iphonewebdev.com, which is the largest community of iPhone-based web developers anywhere, and manages its mailing list. He also helped to organize iPhoneDevCamp and oversaw its Hack-a-thon. Christopher is a longtime technologist, and is also a leader in social software and was one of the authors of TLS, the next-generation SSL protocol.

Shannon Appelcline is a writer and technologist. He was a participant in Charles River Media's Massively Multiplayer Game Development 2. He has also been published by Chaosium Inc., Issaries Inc., Jones Publishing, Partizan Press, White Wolf Publishing, and Wizards of the Coast. In 2007 he wrote over 350,000 words for professional publication, including books for Mongoose Publishing and Moon Design Publications. He has also written fiction published by Green Knight Publishing and comic books published by Skotos Tech.

If you're new to iPhone development, this is your book!

Larry C. Whipple, Mobile Productivity, Inc.

Get this book. It's pure gold.

Martijn Dashorst, Author of Wicket in Action

The quick & easy guide.

Premkumar Rajendran, HCL Technologies

The only book on iPhone development I will ever need.

Rama Krishna Vavilala, Author of ASP.NET AJAX in Action