Skip to main content

iOS App Development Portable Genius

iOS App Development Portable Genius

ISBN: 978-1-118-46213-3

Jun 2012

432 pages

Select type: E-Book


Product not available for purchase


The essential skills and technologies needed for iOS development in one handy guide!

The unprecedented popularity of iOS devices, such as the iPhone, iPad, and iPod touch, has led to a development boom. If you’re eager to become part of the action, then this is the book for you! Packed with must-have information on iOS development, this handy guide covers Objective-C, Xcode, Frameworks, and sound design principles and explains how to upload an app to the app store and integrate apps with the latest advances that Apple offers developers. The featured tips and tricks will get you up and running and sharpen your skills as an iOS developer.

  • Gets savvy beginning developers started with iOS development while also keeping experienced iOS developers up to date on the latest in this field
  • Features easy-to-follow instructions on the strong and stable iOS platform

iOS Development Portable Genius covers all the essentials you need to get started with iOS development today.

Acknowledgments vii

Introduction xviii

chapter 1 How Can I Start Developing for iOS? 2

Getting Started with App Development 4

Choosing a Mac 6

Choosing a processor 6

Selecting memory 7

Selecting a monitor 8

Selecting other peripherals 8

Selecting a form factor 9

Running Xcode on a laptop 9

Running Xcode on an iMac 9

Running Xcode on a Mac Pro 10

Running Xcode on a Mac Mini 10

Joining the iOS Developer Program 11

Understanding enrollment options 11

Enrolling in the iOS Developer Program 12

Downloading and Installing Xcode 14

Understanding SDKs and betas 14

Installing Xcode from the App Store 15

Installing Xcode from a developer download 17

Understanding other installation requirements 19

Updating devices 20

Installing documentation 22

chapter 2 How Do I Get Started with Xcode? 24

Understanding Xcode 26

Introducing Xcode’s User Interface 28

Introducing the main Xcode window 29

Viewing and hiding UI features 31

Using the View buttons 32

Using the Editor buttons 33

Understanding the Assistant Editor 34

Understanding the Version Editor 35

Using the Organizer 36

Using the other toolbar features 37

Introducing the Navigator area 37

Using the Project navigator 38

Listing and grouping project files 39

Viewing build settings 40

Introducing the Editor area 41

Introducing iOS and the Apple Documentation 43

Understanding Resource Types 45

Understanding Topics 46

Understanding frameworks and layers 47

Using the documentation browser 50

Accessing the documentation 51

Accessing documentation

in the Organizer 51

Accessing the documentation from a web browser 52

Getting Further Help 53

Putting It All Together 55

chapter 3 How Do I Build and Run an Application? 56

Building Applications 58

Creating a new project 58

Building a project 61

Working with the Simulator 64

Understanding Xcode’s Project Templates 64

Creating iPhone, iPad, and Universal projects 65

Exploring the app templates 67

Master-Detail Application 67

OpenGL Game 68

Page-Based Application 69

Single-View Application 69

Tabbed Application 70

Utility Application 71

Empty Application 72

Customizing and expanding templates 73

Building Apps from Sample Code 75

Building sample projects from the documentation 75

Loading projects from the Organizer 76

Loading projects from the online documentation 78

Building sample projects from other sources 80

Building Apps for Test Devices 81

Understanding certificates and provisioning 81

Creating certificates and provisioning profiles 82

Using devices for testing 84

chapter 4 What Are Applications Made Of? 86

Understanding Applications 88

Understanding messages 88

Using messages in practice 90

Understanding code 90

Understanding messages in objects 95

Building apps from messages 96

Understanding App Structure 97

Understanding message timing 99

Working with message timing 100

Introducing Views, Nib Files, and Storyboards 101

Looking at nib files 102

Adding objects to a UI 103

Understanding the view hierarchy 105

Modifying views and the view hierarchy 106

Understanding Views and Controllers 108

Introducing storyboards 108

Introducing Model-View-Controller (MVC) 109

Using MVC 110

Working with MVC messages 111

Appreciating Graphic Design 112

Summarizing UI Creation 113

chapter 5 How Do I Create Code? 114

Introducing Code Design 116

Organizing data 116

Mixing C and Objective-C 117

Editing and Building Code 118

Understanding Errors and Warnings 119

Understanding compile-time errors 119

Understanding warnings 120

Understanding run-time errors 120

Understanding the C Language 121

Understanding computers 122

Representing data in C 123

Using text in C 124

Using numbers in C 125

Creating a Simple App in C 126

Adding code 126

Managing data 129

Naming variables 130

Displaying variables 130

Working with memory 132

Introducing pointers 133

Grouping data 134

Introducing arrays 134

Introducing structs 135

Making decisions 136

Repeating code 137

Re-using code with functions 138

Understanding scope 140

Using other C idioms 141

Bitwise operations 141

Manipulating numbers 142

Converting between types 143

Using the standard library 143

chapter 6 How Do I Use Objects in My Code? 146

Moving from C to Objective-C 148

Thinking with objects 148

Understanding classes 149

Understanding inheritance 151

Exploring messaging and behaviors 152

Introducing Objective-C Code 154

Working with messages and properties 154

Creating objects 157

Defining Classes in Your App 157

Using premade subclasses 159

Understanding the interface file 160

Looking at an interface file 161

Looking at an implementation file 163

Using @synthesize 164

Adding your own subclasses 164

Using subclassing 167

Adding features 168

Overriding methods 169

Exploring touch messages 170

Getting started 171

Going Deeper with Objective-C 174

Introducing selectors 174

Using Target-Action 175

Getting started with delegates and protocols 176

Class methods 177

chapter 7 How Can I Use Objects to Manage Data and Schedule Events? 180

Managing Text with NSString 182

Creating a string 182

Comparing strings 183

Managing Data Collections 184

Understanding mutable collections 186

Understanding “objectification” 188

Using NSNumber 189

Using NSValue 190

Using NSData 192

Understanding key-value coding (KVC) 192

Basic KVC 192

Using KVC with NSDictionary 194

Using NSSet 196

Processing objects in collections 198

Running methods on objects in a collection 198

Checking method availability 199

Key-value observing (KVO) 200

Scheduling Events 202

Creating a simple delay 202

Creating a simple timer 203

Scheduling an event at a future time 204

chapter 8 How Do I Handle Input from the User? 206

Understanding User Interaction 208

Introducing actions, outlets, and responder events 208

Working with actions, outlets, and responder events 208

Working with Action Messages 209

Working with action messages in IB 210

Adding a button to a view 210

Customizing the appearance of a control 211

Creating event handlers in code 214

Filling in an event handler 217

Editing action connections 218

Deleting a connection 218

Creating connections manually 219

Connecting a method to an object 220

Connecting an object to a method 222

Understanding (id) sender 222

Creating and Using Outlets 224

Creating an outlet 224

Using an outlet 227

Using the Responder System 229

Working with a text field 230

Working with touch events 232

Working with single touch events 232

Working with multi-touch 234

Introducing gestures 236

Working with gesture recognizers 236

Subclassing in IB 238

chapter 9 What Are Frameworks and How Do I Use Them? 242

Understanding Frameworks 244

Understanding iOS frameworks 244

Introducing third-party frameworks 247

Adding an iOS Framework to a Project 249

Finding the framework you need 249

Adding a framework to a project 250

Including framework header files 252

Adding objects from a framework to your project 254

Understanding Delegates and Protocols 256

Understanding delegates 256

Using delegates and protocols 258

Adding a Third-Party Framework to a Project 261

chapter 10 How Do I Add Custom Graphics to My App? 266

Understanding UI Design 268

Creating an excellent UI 268

Designing a UI step by step 269

Sourcing Custom Graphics 271

Finding clip art and icons 271

Creating art manually 272

Paying a graphic designer 274

Using Custom Graphics 274

Adding a media file to your project 274

Creating a customized app background 275

Customizing controls 278

Creating icons and splash screens 280

Working with fonts 282

Drawing Graphics with Code 283

Using paths, strokes, and fills 283

Uncommenting drawRect: 283

Understanding screen coordinates 284

Creating a CGRect for a path 284

Creating the path 285

Stroking and filling a path 286

Creating views and controls with code 288

Swapping Screens 292

Adding a modal screen 292

Creating more complex screen swaps 294

Using a storyboard 294

Managing rotation 300

Controlling rotation 300

Controlling object layout 301

Adding Animations 302

Understanding animation technologies in iOS 302

Creating a UIView animation 303

chapter 11 How Do I Add Other Standard App Features? 306

Multitasking 308

Setting up task switching 309

Entering background mode 311

Introducing the info.plist file 311

Adding multitasking options to info.plist 313

Working in the background 315

Working with event notifications 315

Creating notifications 315

Responding to notifications 316

Using threads 316

Using blocks 317

Managing Memory 318

Understanding manual memory management 319

Using ARC with Objective-C code 320

Working with Files 321

Playing Sounds and Videos 324

Playing a sound with AVAudioPlayer 324

Creating an NSURL for a file

in the app bundle 325

Introducing NSError 325

Working with AVAudioPlayer 326

Working with MPMoviePlayerController 327

Connecting to the Internet 327

Checking for a connection 328

Using APIs 328

Creating Preferences 331

Adding and editing a Settings Bundle 332

Registering preferences 334

Accessing and setting values 335

Localizing Apps 336

Creating Localized.strings 336

Using Localized.strings 337

Creating localized nib files 338

chapter 12 How Do I Test and Fix My App? 340

Testing Apps 342

User-testing your app 342

Avoiding unintuitive design 342

Getting user feedback 343

Introducing test builds 344

Getting started with debugging 344

Using the Xcode Debugger 346

Adding a breakpoint 347

Stepping through code 350

Viewing objects, variables, and memory 351

Using the variables and objects view 351

Hovering over objects and variables 353

Creating conditional breakpoints 353

Deleting, listing, and editing breakpoints 354

Getting Started with Instruments 355

Running Instruments 356

Launching Instruments manually 357

Launching Instruments for app profiling 357

Understanding the Allocations list 358

chapter 13 How Do I Distribute Apps for Sale and Testing? 362

Understanding App Distribution 364

Introducing digital identities 365

Getting started with distribution profiles 366

Creating a Digital Identity 367

Generating a certificate signing request 367

Creating a CSR file 367

Creating a distribution certificate 368

Installing the certificates 370

Creating an App ID 371

Understanding app IDs 371

Using reverse domain names 371

Creating a matching bundle ID 373

Adding Test Devices 374

Finding a device UDID 374

Adding a device UDID 375

Creating and Installing Distribution Profiles 376

Creating a distribution profile 377

Installing distribution profiles 377

Creating an Ad Hoc Build 380

Setting the Deployment Target 380

Creating an Ad Hoc archive 380

Distributing an Ad Hoc app for testing 382

Distributing via iTunes 383

OTA distribution 384

Uploading to the App Store 385

Creating support materials 386

Building and distributing to the App Store 388

C Data Types 390C Storage Classes 391

Composite C Data Types 392

C Statements and Functions 392

Comparing C and Objective-C 394

NSLog and printf Format Specifiers 395

appendix a C Cheat Sheet 390

Glossary 396

Index 402