Skip to main content

Beginning iOS 4 Application Development

Beginning iOS 4 Application Development

Wei-Meng Lee

ISBN: 978-1-118-00480-7

Sep 2010

656 pages

Select type: E-Book

Product not available for purchase


The ideal starting point for creating apps using iOS 4

Written by an experienced Apple developer and trainer, this full-color reference serves as an ideal jumping point for creating applications for Apple’s iOS 4 that runs on the iPhone, iPod Touch, and iPad. In addition to in-depth coverage of the iOS SDK, the book walks you through the various core aspects of iPhone and iPad development. You’ll learn how to take advantage of the tools provided by XCode and you’ll benefit from a solid introduction to Objective-C, which allows you to have a smooth transition to iPhone development from another platform. 

  • Offers a solid foundation for creating applications for Apple’s iOS 4
  • Covers all the new features of iOS 4 and provides a new applications template for developing iPad and iPhone apps
  • Addresses the new PopoverView for iPad apps
  • Shows how to develop background applications, which is one of the new features in iOS 4

Beginning iOS 4 Application Development is your ultimate resource for creating applications for Apple's iOS 4.

Introduction xvii

Part I: Getting Started

Chapter 1: Getting Started with iOS 4 Programming 3

Obtaining the iPhone SDK 4

Components of the iPhone SDK 6

Some Useful Information before You Get Started 17

Summary 20

Chapter 2: Write Your First Hello World! Application 23

Getting Started with Xcode 23

Customizing Your Application Icon 34

Displaying a Splash Screen 36

Summary 39

Chapter 3: Views, Outlets, and Actions 41

Outlets and Actions 41

Using Views 47

Adding Views Dynamically Using Code 64

Understanding View Hierarchy 68

Summary 70

Chapter 4: View Controllers 73

The View-Based Application Template 74

The Window-Based Application Template 85

The Split View-Based Application Template 103

The Tab Bar Application Template 122

Summary 131

Chapter 5: Multi-Platform Support for the iPhone and iPad 133

Technique 1 — Modifying the Device Target Setting 134

Technique 2 — Creating Universal Applications 141

Technique 3 — Maintaining Two Code Bases 149

Making Your Choice 151

Summary 152

Chapter 6: Keyboard Inputs 155

Using the Keyboard 155

Customizing the Type of Inputs 157

Detecting the Presence of the Keyboard 165

Summary 178

Chapter 7: Screen Rotations 181

Responding to Device Rotations 181

Programmatically Rotating the Screen 190

Summary 192

Part II : Displaying and Persisting Data

Chapter 8: Using the Table View 197

A Simple Table View 198

Using the Table View in a Navigation-Based Application 210

Displaying Sections 210

Summary 239

Chapter 9: Application Preferences 241

Creating Application Preferences 242

Programmatically Accessing the Settings Values 248

Summary 257

Chapter 10: File Handling 261

Understanding the Application Folders 262

Using Property Lists 267

Copying Bundled Resources 274

Summary 275

Chapter 11: Database Storage Using SQLite3 279

Using SQLite3 280

Creating and Opening a Database 282

Bundling SQLite Databases with Your Application 291

Summary 292

Part III : Advanced iOS 4 Programming Techniques

Chapter 12: Simple Animations and Video Playback 297

Using the NSTimer Class 297

Transforming Views 305

Animating a Series of Images 310

Playing Video on the iPhone 313

Summary 317

Chapter 13: Accessing Built-In Applications 319

Sending E‑Mails 319

Accessing the Camera and the Photo Library 328

Summary 341

Chapter 14: Recognizing Gestures 343

Recognizing Gestures 343

Detecting Touches 367

Summary 383

Chapter 15: Accessing the Accelerometer 385

Using the Accelerometer 385

Visualizing the Accelerometer Data 388

Using the Shake API to Detect Shakes 392

Summary 399

Part IV: Network Programming Techniques

Chapter 16: Web Services 403

Basics of Consuming XML Web Services 403

Consuming a Web Service in Your iPhone Application 407

Parsing the XML Response 413

Summary 418

Chapter 17: Bluetooth Programming 421

Using the Game Kit Framework 421

Implementing Voice Chatting 431

Summary 438

Chapter 18: Bonjour Programming 441

Creating the Application 441

Publishing a Service 443

Browsing for Services 446

Summary 452

Chapter 19: Apple Push Notification Service 455

Generating a Certificate Request 456

Generating a Development Certificate 457

Creating an Application ID 461

Creating the iPhone Application 467

Creating the Push Notification Provider 471

Summary 475

Chapter 20: Displaying Maps 477

Displaying Maps and Monitoring Changes Using the Map Kit 477

Getting Location Data 483

Summary 515

Chapter 21: Background Applications 519

Understanding Background Execution on the iPhone 519

Local Notification 530

Summary 537

Part V: Appendices

Appendix A: Testing on an Actual Device 541

Signing Up for the iPhone Developer Program 541

Obtaining the UDID of Your Device 541

Logging in to the iPhone Provisioning Portal 542

Generating a Certificate 544

Registering Your Devices 547

Creating an Application ID 548

Creating a Provisioning Profile 550

Understanding Application ID and the Wildcard 554

Preparing for App Store Submission 557

Summary 563

Appendix B: Getting Around in Xcode 565

Launching Xcode 565

Debugging Your Applications 571

Appendix C: Getting Around in Interface Builder 577

.xib Window 577

Designing the View 578

Inspector Window 579

Library 581

Outlets and Actions 582

Appendix D: Crash Course in Objective-C 591

Directives 591

Classes 592

Memory Management 605

Protocols 612

Selectors 615

Categories 616

Appendix E: Answers to Exercises

Index 619

Source Code Download - 4.0
Source Code Download - 4.3 of the SDK
Appendix E: Answers to Exercises
ChapterPageDetailsDatePrint Run
18Error in Appendix Reference
"To test your applications on a device, you must sign up for the iPhone Developer Program and request that a developer certificate be installed on to your device. Appendix E outlines the steps in detail."

Change "Appendix E" to "Appendix A".

59Grammar Correction
The sentence "get the page number you can turning to"

should be:
"get the page number you can turn to".

592Error in Text
Line 4. The text 'you use the " and " characters' uses monotype font unnecessarily for the word 'and' since the word 'and' is not part of source code.