LET'S CONNECT!
Enter for a chance to win an eBook of your choice from InformIT. Fill out the form.
Rough Cuts are manuscripts that are developed but not yet published, available through Safari. Rough Cuts provide you access to the very latest information on a given topic and offer you the opportunity to interact with the author to influence the final publication.
This is a working draft of a pre-release book. It is available before the published date as part of the Rough Cuts service.
“This book would be a bargain at ten times its price! If you are writing iPhone software, it will save you weeks of development time. Erica has included dozens of crisp and clear examples illustrating essential iPhone development techniques and many others that show special effects going way beyond Apple’s official documentation.”
–Tim Burks, iPhone Software Developer, TootSweet Software
“Erica Sadun’s technical expertise lives up to the Addison-Wesley name. The iPhone Developer’s Cookbook is a comprehensive walkthrough of iPhone development that will help anyone out, from beginners to more experienced developers. Code samples and screenshots help punctuate the numerous tips and tricks in this book.”
–Jacqui Cheng, Associate Editor, Ars Technica
“We make our living writing this stuff and yet I am humbled by Erica’s command of her subject matter and the way she presents the material: pleasantly informal, then very appropriately detailed technically. This is a going to be the Petzold book for iPhone developers.”
–Daniel Pasco, Lead Developer and CEO, Black Pixel Luminance
“The iPhone Developer’s Cookbook should be the first resource for the beginning iPhone programmer, and is the best supplemental material to Apple’s own documentation.”
–Alex C. Schaefer, Lead Programmer, ApolloIM, iPhone Application Development Specialist, MeLLmo, Inc.
“Erica’s book is a truly great resource for Cocoa Touch developers. This book goes far beyond the documentation on Apple’s Web site, and she includes methods that give the developer a deeper understanding of the iPhone OS, by letting them glimpse at what’s going on behind the scenes on this incredible mobile platform.”
–John Zorko, Sr. Software Engineer, Mobile Devices
“I’ve found this book to be an invaluable resource for those times when I need to quickly grasp a new concept and walk away with a working block of code. Erica has an impressive knowledge of the iPhone platform, is a master at describing technical information, and provides a compendium of excellent code examples.”
–John Muchow, 3 Sixty Software, LLC; founder, iPhoneDeveloperTips.com
“This book is the most complete guide if you want coding for the iPhone, covering from the basics to the newest and coolest technologies. I built several applications in the past, but I still learned a huge amount from this book. It is a must-have for every iPhone developer.”
–Roberto Gamboni, Software Engineer, AT&T Interactive
“It’s rare that developer cookbooks can both provide good recipes and solid discussion of fundamental techniques, but Erica Sadun's book manages to do both very well.”
–Jeremy McNally, Developer, entp
Want to get started building applications for Apple’s iPhone and iPod touch? Already building iPhone applications and want to get better at it? This is the only book that brings together all the ex Preface xix
1 Introducing the iPhone SDK 1
iPhone Developer Programs 1
Getting Started 3
Understanding Model Differences 7
Platform Limitations 9
SDK Limitations 12
Using the Developer Portal 13
Assembling iPhone Projects 17
iPhone Application Components 22
Programming Paradigms 28
Summary 35
2 Building Your First Project 37
Creating New Projects 37
Building Hello World the Template Way 39
Using the Simulator 46
The Minimalist Hello World 48
Using the Debugger 53
Memory Management 58
Recipe: Using Instruments to Detect Leaks 59
Recipe: Using Instruments to Monitor Cached Object Allocations 62
Using the Clang Static Analyzer 64
Building for the iPhone 65
From Xcode to Your iPhone: The Organizer Interface 69
Using Compiler Directives 73
Building for Distribution 78
Clean Builds 80
Building for Ad Hoc Distribution 83
Customizing Xcode Identities 85
Creating Custom Xcode Templates 86
One More Thing: Viewing Side-by-Side Code 88
Summary 89
3 Objective-C Boot Camp 91
The Objective-C Programming Language 91
Classes and Objects 92
Methods, Messages, and Selectors 95
Class Hierarchy 102
Logging Information 103
Properties 105
Simple Memory Management 110
Crafting Singletons 119
Categories (Extending Classes) 120
Protocols 122
Foundation Classes 125
One More Thing: Message Forwarding 138
Summary 141
4 Designing Interfaces 143
UIView and UIWindow 143
UIViewControllers 147
View Design Geometry 151
Building Interfaces 155
Walk-Through: Building a Temperature Converter with IB 156
Walk-Through: Building a Converter Interface by Hand 166
Walk-Through: Creating a Hybrid Converter 169
Walk-Through: Loading .xib Files Directly from Code 173
Designing for Rotation 174
Enabling Reorientation 175
Autosizing 176
Moving Views 179
Swapping Views 183
One More Thing: A Half Dozen Great Interface Builder Tips 184
Summary 186
5 Working with View Controllers 187
Developing with Navigation Controllers 187
Utility Function 190
Recipe: Building a Simple Two-Item Menu 192
Recipe: Adding a Segmented Control 193
Recipe: Navigating Between View Controllers 195