Home > Store > Home & Office Computing > Entertainment/Gaming/Gadgets

larger cover

Add To My Wish List

iPhone Developer's Cookbook, The: Building Applications with the iPhone SDK

  • By Erica Sadun
  • Published Oct 13, 2008 by Addison-Wesley Professional. Part of the Developer's Library series.
    • Copyright 2009
    • Dimensions: 7 X 9
    • Pages: 384
    • Edition: 1st
    • Book
    • ISBN-10: 0-321-55545-7
    • ISBN-13: 978-0-321-55545-8
    • eBook (Watermarked)
    • ISBN-10: 0-321-55351-9
    • ISBN-13: 978-0-321-55351-5

Register your product to gain access to bonus material or receive a coupon.

  • Description
  • Downloads
  • Extras
  • Reviews
  • Sample Content
  • Updates

Product Author Bios

Erica Sadun has written, coauthored, and contributed to about three dozen books about technology, particularly in the areas of programming, digital video, and digital photography. An unrepentant geek, Sadun has never met a gadget she didn’t need. Her checkered past includes run-ins with NeXT, Newton, iPhone, and myriad successful and unsuccessful technologies. When not writing, she and her geek husband parent three adorable geeks-in-training, who regard their parents with restrained bemusement.

“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: Building Applications with the iPhone SDK 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

 

The iPhone and iPod touch aren’t just attracting millions of new users; their breakthrough development platform enables programmers to build tomorrow’s killer applications. If you’re getting started with iPhone programming, this book brings together tested, ready-to-use code for hundreds of the challenges you’re most likely to encounter. Use this fully documented, easy-to-customize code to get productive fast—and focus your time on the specifics of your application, not boilerplate tasks.

 

Leading iPhone developer Erica Sadun begins by exploring the iPhone delivery platform and SDK, helping you set up your development environment, and showing how iPhone applications are constructed. Next, she offers single-task recipes for the full spectrum of iPhone/iPod touch programming jobs:

  • Utilize views and tables
  • Organize interface elements
  • Alert and respond to users
  • Access the Address Book (people), Core Location (places), and Sensors (things)
  • Connect to the Internet and Web services
  • Display media content
  • Create secure Keychain entries
  • And much more

 

You’ll even discover how to use Cover Flow to create gorgeous visual selection experiences that put scrolling lists to shame!

 

This book is organized for fast access: related tasks are grouped together, and you can jump directly to the right solution, even if you don’t know which class or framework to use. All code is based on Apple’s publicly released iPhone SDK, not a beta. No matter what iPhone projects come your way, The iPhone Developer’s Cookbook will be your indispensable companion.

 

Customer Reviews

139 of 149 people found the following review helpful
2.0 out of 5 stars New to Apple's Developer Tools? This book is not for you!, November 17, 2008
By 
Jason R. Weiss (Katy, TX USA) - See all my reviews
(REAL NAME)   
Amazon Verified Purchase(What's this?)
This review is from: The iPhone Developer¿s Cookbook: Building Applications with the iPhone SDK (Paperback)
The book states it is aimed "squarely at anyone just getting started with iPhone programming." It is not.

At the time of purchase, I was a brand new iPhone developer with zero exposure to Apple's developer tools and their iPhone SDK. That said, I am a very seasoned Java and C# developer, I have used Eclipse and VS.NET extensively for numerous years to build some very sophisticated applications. Apple's developer tools, XCode and Interface Builder, are radically different tools unlike either of these development environments. Instead of a singular IDE, the Apple tools are a hodgepodge of separate applications filling your screen with a plethora of small tool and inspector windows. If you are brand new to XCode and Interface Builder, this book simply doesn't have enough horse power to properly educate you on the pitfalls newbies will face.

If you are already familiar with Apple's developer tools, then the book may be better received by you then by someone who... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


39 of 44 people found the following review helpful
3.0 out of 5 stars Not For Beginners, October 27, 2008
By 
Jerry Palmerino Jr (United States) - See all my reviews
(VINE VOICE)   
Amazon Verified Purchase(What's this?)
This review is from: The iPhone Developer¿s Cookbook: Building Applications with the iPhone SDK (Paperback)
The "Who This Book Is For" section of this book states: "This book is written for new iPhone developers with projects to get done and a new unfamiliar SDK in their hands." I am rating this book three stars because it does not live up to this statement.

As someone familiar enough with Xcode and iPhone development to understand the Apple templates and Cocoa design patterns, I was sadly disappointed when I discovered that the code listings in this book were not separated into .m and .h files. Rather, all code is jumbled up into long single-file, multipage listings. The author even states that this format is suited for book publishing. I whole-heartedly feel that this single issue makes this book worthless to a new iPhone developer. Why? A newly created default iPhone project in Xcode has separate .h and .m files.

In addition to the above-mentioned flaw, this book does little beyond Chapter one to hand-hold a new iPhone developer. This book in not... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


14 of 16 people found the following review helpful
2.0 out of 5 stars Not for Starters, October 30, 2008
By 
J. W. ten Pas (Uden,Netherlands) - See all my reviews
(REAL NAME)   
This review is from: The iPhone Developer¿s Cookbook: Building Applications with the iPhone SDK (Paperback)
I hoped for a good introduction in Iphone programming, but am disappointed. The book doesn't conform to Cocoa programming standards which is very annoying. For example, all the Code is put in the 'main' file, not the way it should be. From a teaching perspective it's confusing. Bits of code are presented without proper explanation to which class they belong and poor code evaluation. Perhaps no big deal for experienced iPhone programmers, but for starters like me very tedious to read. Dont expect a book with a quality like "Cocoa Programming for MAC OS X from Aaron Hillegass. If you're starter wait for better books, This one won't help you. It only teaches bad habbits.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


Share your thoughts with other customers:
 See all 44 customer reviews...

Sample Pages

Download the sample pages

Table of Contents

    Preface xvii

    Acknowledgments xxi

    About the Author xxii

 

1 Introducing the iPhone SDK 1

    Apple’s iPhone SDK 1

    Assembling iPhone Projects 2

    iPhone Application Components 4

        Application Folder Hierarchy 4

        The Executable 4

        The Info.plist File 4

        The Icon and Default Images 6

        XIB (NIB) files 6

        Files Not Found in the Application Bundle 7

        Sandboxes 7

    Platform Limitations 8

        Storage Limits 8

        Data Access Limits 8

        Memory Limits 8

        Interaction Limits 9

        Energy Limits 9

        Application Limits 9

        User Behavior Limits 10

    SDK Limitations 10

    Programming Paradigms 11

        Object-Oriented Programming 11

        Model-View-Controller 11

    Building an iPhone Application Skeleton 18

    The Hello World Application 19

        The Classes 19

        The Code 20

        A Note About Sample Code and Memory Management 20

    Building Hello World 23

        Create an iPhone Project 23

        Running the Skeleton 24

        Customize the iPhone Project 24

        Editing Identification Information 25

        Using the Debugger 26

    Apple’s iPhone Developer Program 28

        Development Phones 28

        Application Identifiers 29

    From Xcode to Your iPhone: The Organizer Interface 30

        Projects and Sources List 30

        Devices List 31

        Summary Tab 31

        Console Tab 31

        Crash Logs Tab 31

        Screenshot Tab 32

        About Tethering 32

        Testing Applications on Your iPhone 32

        Compiling for Distribution 33

    Using Undocumented API Calls 34

    Ad Hoc Distribution 35

    Summary 36

 

2 Views 37

    UIView and UIWindow 37

        Hierarchy 37

        Geometry and Traits 39

        Gestures 42

    Recipe: Adding Stepwise Subviews 42

        Reorienting 44

    Recipe: Dragging Views 45

        UITouch 46

        Adding Persistence 48

    Recipe: Clipped Views 51

        Balancing Touches with Clipping 53

        Accessing Pixel-by-Pixel Values 54

    Recipe: Detecting Multitouch 56

    UIView Animations 59

        Building UIView Animation Blocks 59

    Recipe: Fading a View In and Out 60

    Recipe: Swapping Views 62

    Recipe: Flipping Views 64

    Recipe: Applying CATransitions to Layers 66

        Undocumented Animation Types 67

        General Core Animation Calls 68

    Recipe: Swiping Views 69

    Recipe: Transforming Views 72

        Centering Landscape Views 74

    Summary 74

 

3 View Controllers 77

    View Management 77

        Core Classes 77

        Specialized Classes 78

        Creating a UIViewController 79

    Working with Interface Builder to Build Views for

    UIViewControllers 81

        Temperature Conversion Example 81

        Loading XIB Files Directly 90

    Navigation Controllers 91

        Setting Up a Navigation Controller 91

        Pushing and Popping View Controllers 92

        The Navigation Item Class 92

    Recipe: Building a Simple Two-Item Menu 93

    Recipe: Adding a Segmented Control 95

    Recipe: Adding a UIToolbar to a Navigation Bar 97

    Recipe: Navigating Between View Controllers 100

        Popping Back to the Root 102

        Loading a View Controller Array 102

    Tab Bars 103

    Summary 106

 

4 Alerting Users 107

    Talking Directly to Your User Through Alerts 107

        Logging Your Results 108

        Building Alerts 109

        Displaying the Alert 110

    Recipe: Creating Multiline Button Displays 110

    Recipe: Autotimed No-Button Alerts 112

    Recipe: Soliciting Text Input from the User 113

    Recipe: Presenting Simple Menus 115

    “Please Wait”: Showing Progress to Your User 117

    Recipe: Invoking the Basic Undocumented UIProgressHUD 117

    Recipe: Using UIActivityIndicatorView 119

    Recipe: Building a UIProgressView 121

    Recipe: Adding Custom, Tappable Overlays 123

    Recipe: Building a Scroll-Down Alert 127

    Recipe: Adding Status Bar Images 131

    Adding Application Badges 132

    Recipe: Simple Audio Alerts 134

        Vibration 136

    Summary 136

 

5 Basic Tables 139

    Introducing UITableView and UITableViewController 139

        Creating the Table 140

        What the UITableViewController Does 141

    Recipe: Creating a Simple List Table 142

        Data Source Functions 142

        Reusing Cells 143

        Font Table Sample 143

    Recipe: Creating a Table-Based Selection Sheet 145

    Recipe: Loading Images into Table Cells 149

    Recipe: Setting a Cell’s Text Traits 151

    Removing Cell Selections 152

    Recipe: Creating Complex Cells 153

    Recipe: Creating Checked Selections 155

    Recipe: Deleting Cells 157

        Creating and Displaying Remove Controls 157

        Dismissing Remove Controls 158

        Handling Delete Requests 158

        Swiping Cells 158

        Adding Cells 159

    Recipe: Reordering Cells 161

    Recipe: Working with Disclosures 162

    Summary 164

     

6 Advanced Tables 165

    Recipe: Grouping Table Selections 165

        Building a Section-Based Data Source 166

        Adding Section Headers 170

    Recipe: Building a Section Table with an Index 171

    Recipe: Custom Cell Backgrounds 172

        Customizing the Table View 176

    Recipe: Creating Alternate Blue and White Cells 177

    Recipe: Framing Tables 179

    Recipe: Adding Coupled Cell Controls 180

    Recipe: Building a Multiwheel Table 182

        Creating the UIPickerView 183

    Recipe: Using the UIDatePicker 186

        Creating the Date Picker 186

    Recipe: Creating Fully Customized Group Tables 189

        Creating Grouped Preferences Tables 189

    Summary 195

 

7 Media 197

    Recipe: Browsing the Documents Folder by File Type 197

        Locating Documents 198

    Loading and Viewing Images 200

    Recipe: Displaying Small Images 201

    Recipe: Using a UIWebView to Display Images 203

        Displaying Web Pages with UIWebView 205

    Recipe: Browsing Your Image Library 206

    Recipe: Selecting and Customizing Images from the Camera Roll 209

    Recipe: Snapping Pictures with the iPhone Camera 212

    Working with iPhone Audio 214

    Recipe: Playing Audio with Celestial 215

    Recipe: Using the Media Player for Audio and Video Playback 217

    Recipe: Recording Audio 219

    Reading in Text Data 227

        Displaying Property Lists 227

    Recovering Media from Backup Files 228

    Summary 229

 

8 Controls 231

    Recipe: Building Simple Buttons 231

        The UIButton class 232

        Building Custom Buttons 233

        Glass Buttons 236

    Recipe: Adding Animated Elements to Buttons 236

    Recipe: Animating Button Responses 238

    Recipe: Customizing Switches 239

        Customizing UIAlertView Buttons 241

    Recipe: Adding Custom Slider Thumbs 242

        Adding Text to the Slider 246

    Recipe: Dismissing a UITextField Keyboard 246

    Recipe: Dismissing UITextView Keyboards 248

    Recipe: Adding an Undo Button to Text Views 250

    Recipe: Creating a Text View—Based HTML Editor 253

    Recipe: Building an Interactive Search Bar 255

    Recipe: Adding Callout Views 258

    Adding a Page Indicator Control 260

    Recipe: Customizing Toolbars 263

        Toolbar Tips 266

    Summary 267

 

9 People, Places, and Things 269

    Address Book Frameworks 269

        Address Book UI 269

        Address Book 270

    Recipe: Accessing Address Book Image Data 271

    Recipe: Displaying Address Book Information 273

    Recipe: Browsing the Address Book 274

        Browsing for (Only) E-Mail Addresses 277

        Adding New Contacts 277

    Core Location 278

        How Core Location Works 278

    Recipe: Core Location in a Nutshell 280

    Recipe: Reverse Geocoding to an Address 283

    Recipe: Accessing Maps Using Core Location Data 286

    Recipe: Accessing Core Device Information 288

    Recipe: Enabling and Disabling the Proximity Sensor 289

    Recipe: Using Acceleration to Locate “Up” 290

    Recipe: Using Acceleration to Move Onscreen Objects 292

    Summary 295

 

10 Connecting to Services 297

    Recipe: Adding Custom Settings Bundles 297

        Declaring Application Settings 297

    Recipe: Subscribing Applications to Custom URL Schemes 302

    Recipe: Checking Your Network Status 304

        Testing the Network Status 304

        Recovering a Local IP Address 305

        Querying Site IP Addresses 306

        Checking Site Availability 307

    Recipe: Interacting with iPhone Databases 308

    Recipe: Converting XML into Trees 311

    Recipe: Storing and Retrieving Keychain Items 313

            Storing Multiple Keychain Values 318

            Keychain Persistence 319

    Sending and Receiving Files 320

    Recipe: Building a Simple Web-Based Server 321

    Push Notifications 325

    Summary 326

 

11 One More Thing: Programming Cover Flow 327

    The UICoverFlowLayer Class 327

    Building a Cover Flow View 329

    Building a Cover Flow View Controller 331

        Cover Flow Data Source Methods 332

        Cover Flow Delegate Methods 333

    Summary 336

 

Index 357

 

Book

This product currently is not for sale.

Buy

eBook (Watermarked)  $31.99  $25.59

About Watermarked eBooks

This PDF will be accessible from your Account page after purchase and requires the free Adobe® Reader® software to read it.

The eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.

Watermarked eBook FAQ

Purchase Reward: One Month Free Subscription
By completing any purchase on InformIT, you become eligible for an unlimited access one-month subscription to Safari Books Online.

Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.