Index

Symbols

// (double slash), comment syntax and, 28

/* (slash asterisk), comment syntax and, 28

A

Absolute Beginner’s Guide to C, Second Edition (Perry), 26

accessories, adding to table cells, 211–213

action sheets

delegates, 257

exercise using, 257–260

function of, 238

in Photo application, 252

summary, 262

when to use, 251

actions

connecting button bar to, 175

IBActions, 130

activity indicators

exercise using, 241–244

function of, 238

showing activity with, 239–240

styles, 240

summary, 261

Activity Monitor, in Instruments, 101

ad hoc

distributing apps, 106–107

testing apps, 105

Add Symbolic Breakpoint, 95

AddViewProjectAppDelegate, 119

alerts

alerting users, 251

creating alert with multiple buttons, 256

creating simple alert, 254–255

delegates, 252–253

function of, 238

summary, 261–262

alloc method

memory management, 54

overview of, 52–53

Amazon.com application, activity indicator on, 239

App IDs

adding applications, 84

creating, 81–82

error message and, 87

App IDs tab, of Provisioning Portal, 81–82

App Store

app reviews, 3

customizing table rows and, 188

distributing apps via, 107–108

membership in iPhone Developer Program and, 80

navigation controller and, 160–161

overview of, 2

appearance properties, sliders, 277

application badges, 260–261

application settings

changing application name, 334

changing settings while application suspended, 348

field types for settings, 335

key skills and concepts, 330

NSUserDefaults for reading settings, 346

PSChildPaneSpecifier, 344–346

PSGroupSpecifier, 335

PSMultiValueSpecifier, 338–340

PSSliderSpecifier, 342–343

PSTextFieldSpecifier, 335–337

PSToggleSwitchSpecifier, 340–341

reading settings bundle, 347–348

Settings application, 331

settings bundles, 331–334

summary, 348

applicationMusicPlayer, 444

applications

saving application state while multitasking, 368

UIApplication. See UIApplication

apps

creating App ID, 81–82

debugging. See Debugger

deploying to iPhone, 83–88

distributing, 104–108

distributing Core Data with, 430–432

downloading from App Store, 2–3

exercise building universal app for iPad and iPhone, 460–462

installing, 79–80

key skills and concepts, 78–79

obtaining certificates and registering devices, 80–81

provisioning process, 82–83

summary, 108

testing, 101–104

archiving

adopting NSCoding and NSCopying protocols, 358–359

exercise archiving/unarchiving object hierarchies, 364–367

exercise archiving/unarchiving objects, 360–363

NSKeyedArchiver, 359–360

NSKeyedUnarchiver, 360

overview of, 358

saving application state while multitasking, 368

summary, 369

area buttons, Debugger, 90

arguments, multiple-argument messages in Objective-C, 67–69

arrays

NSArray, 352–354

NSMutableArray, 364, 367

overview of, 35

table lists and, 202

using with pointers, 39–40

assign

as property attribute, 63

specifying properties with, 64–65

attributes

assign, 63

copy, 65–66

creating entities and adding attributes to, 406

in data model, 402

retain, 63

audio. See also multimedia

AudioServicesPlaySystemSound, 437

AVAudioPlayer and AVAudioPlayerDelegate, 438–439

exercise playing a sound and an MP3, 439–442

playing music with MPMusicPlayerController, 444–445

playing sounds, 436

audio players, 438

AudioServicesCreateSystemSoundID, 437

AudioServicesPlaySystemSound

overview of, 437

playing sounds, 436

using to vibrate iPhone, 438

autorelease

memory management, 54–55

method using, 58–59

AutorotateToInterfaceOrientation method, for display orientation, 463–464

AVAudioPlayer, playing sounds with, 436, 438–439

AVAudioPlayerDelegate

exercise playing sounds and MP3s, 439–442

methods, 439

overview of, 438

B

background images

on buttons, 265–266

exercising using custom images on buttons, 266–270

badges, application, 260–261

Bar Button items

adding, 173

adding to toolbars, 271

connecting button bar to actions, 175

Fixed Space Bar Button Item, 273

toolbars for adding, 271

bar buttons

adding, 173

adding to Document window, 179

connecting to actions, 175

Bernighan, Brian, 26

bind methods, SQLite, 386–387

blob (binary large object), loading into NSData, 385–386

breakpoints

Add Symbolic Breakpoint, 95

setting in Debugger, 90–91, 94

throwing exceptions as, 95–96

build configurations

releasing, 106

settings, 107

button bars. See bar buttons

buttons

adding images to, 265–266

adding to toolbars, 271

exercising using custom images with, 266–270

overview of, 265

types of, 270–271

C

C language

arrays and structures, 35

command-line programs, 27

comments, 28

control statements, functions, and

conditional statements, 33–34

creating simple program using Xcode, 27–28

data types and operators, 32–33

functions, 35–36

header file, 29–31

key skills and concepts, 26

pointers, 36–38

preprocessor statements, 31–32

printf statement, 36

SQLite database in, 372

summary, 40

using arrays with pointers, 39–40

C layer, 5

The C Programming Language, Second Edition (Kernighan and Ritchie), 40

Caches directory, 350

cameras. See digital camera, iPhone

canvas

adding buttons and activity indicators to, 242

displaying view in, 12–13

dragging controls to, 14–15

toolbar on, 274

capitalization, of text, 280

catalogs

buttons screen, 265

sample application, 264

categories, Objective-C, 72

cells, in tables

accessorizing, 211–213

customizing, 213–218

editing, 226

Certificates tab

obtaining certificates, 83

of Provisioning Portal, 80–81

CFURL, 437

class methods, Objective-C

overview of, 50–51

sayGoodBye class method example, 51–52

classes, Objective-C

categories and, 72

interface and implementation aspects of, 42–44

method declaration and definition, 44–45

overview of, 42

public, private, and protected variables, 48

Clock application, use of tab bars with, 142–143

Cocoa classes, Objective-C using, 42

Cocoa framework, C language and, 26

Cocoa Fundamentals Guide, 9–10

Cocoa layer, 5

Cocoa Touch, 6

Code Sense, in Xcode, 123

code, stepping through with Debugger, 91

collections, preserving as property list. See property lists

column values, obtaining in SQLite, 378

columns, in tables, 186

command-line programs, C language, 27

comments, C language, 28

compiler directives

@implementation and @interface, 44

@private, @public, and @protected, 48

@property, 63

@throw, 74

compilers, use of protypes by, 29

conditional statements, C language, 33–34

Contact button, as button type, 271–272

content views, 128

context, in Core Data

NSManagedObjectContext, 409

overview of, 400–401

saving changes to model data, 415–416

continuous property, sliders, 277

control statements, C language, 33–34

controls

adding images to buttons, 265–266

buttons, 265

creating simple web browser, 291–294

date pickers, 296–299

dragging to canvas, 14–15

exercise creating a toolbar, 273–275

exercise using a switch and a slider, 277–280

exercise using custom images on buttons, 266–270

exercise using date picker, 299–303

exercise using date picker in Timer mode, 303–306

exercise using image picker controller to manage camera and photo library, 320–326

exercise using picker views to select values, 308–312

exercise using picker views with images, 316–320

exercise using picker views with two components, 312–316

key skills and concepts, 264

notifications and, 326–328

picker views, 306–308

segmented, 287–289

sliders, 276–277

subclasses of UIControl, 129

summary, 294

switches (toggle buttons), 276

for text fields, 280–281

for text views, 286

toolbars, 271–273

types of buttons, 270–271

using text field with a number pad, 282–285

for web views, 289–291

copy

creating objects, 65–66

description of property attributes, 63

memory management and, 54

Core Animation, in Instruments, 101

Core Data

adding detail view, 428–430

adding navigation and editing for a group, 417–423

adding navigation and editing for a list of items within a group, 424–427

attributes, 402

creating a model, 401

creating application for displaying, adding, deleting, and editing a list of groups, 417–423

creating new managed objects, 415

deleting managed objects, 416

distributing with apps, 430–432

entities, 401–402

exercise adding entities and relationships to model, 403–407

exercise fetching a group of entities, 412–414

key skills and concepts, 400

model instance, context, and persistence store, 408–409

overview of, 400–401

relationships, 402

retrieving (fetching) set of objects from, 409–411

saving changes to model data, 415–416

sorting fetched objects, 411

summary, 433

updating managed objects, 416

Core OS layer, iPhone/iPad device technology layers, 5

Core Services layer, iPhone/iPad device technology layers, 5

corporate membership, iPhone Developer, 80

CPU Sampler, in Instruments, 101

CSS, web views and, 289

custom buttons, 270

D

data manipulation, with SQLite, 376

data model. See Core Data

data persistence. See SQLite

data sources

adding delegates and data sources, 194–198

UIPickerViewDatasource, 307–308

UITableViewDataSource, 191–194

data types

C language, 32

id variable type, 69–70

databases, SQLite. See SQLite database

datatips, debugging and, 91

Date mode, UIDatePicker, 300

date pickers

Date mode, 300

exercise using, 299–303

exercise using in Timer mode, 303–306

NSDate values, 297, 299

NSDateFormatter, 299

overview of, 296–298

value changed event, 302

dealloc

debugging and, 97–98

memory management and, 54–55

NSObject class and, 66

Debugger

area buttons, 90

datatips and, 91

deallocating objects and, 97–98

exercise creating Zombie app, 98–101

exercise debugging an application, 93–97

overview of, 89

setting breakpoints, 90–91

stepping through code, 91

testing application with, 22

watchpoints, 92–93

deep copies, 65

default screens, splash screens for universal application, 464–465

defaults, for applications, 346

delegates

applications. See UIApplicationDelegate

AVAudioPlayerDelegate, 438–439

MPMediaPickerControllerDelegate, 443

tables. See UITableViewDelegate

UIActionSheet, 257

UIAlertView, 252–253

UIImagePickerController, 319–320

UIPickerViewDelegate, 307

UIWebView, 290–291

what they are, 120

delete

a list of groups, 417–423

managed objects, 416

rows in tables, 233–234

SQLite database, 387

SQLite records, 395–397

deploying apps, to iPhone, 83–88

deserialization, of property lists, 354–355

Detail Disclosure button, button types, 270–271

detail view, Core Data, 428–430

Developer Connection

documentation available via, 9

downloading Xcode and iOS SDK, 4

Devices tab, Provisioning Portal

installing devices, 83–84

registering devices, 81

digital camera, iPhone

managing with UIImagePickerController, 318–319

notifications and, 326–328

directory structure, 350–351

displays, iPad

connecting to external display, 481–482

exercise centering MoviePlayer on, 478–481

orientation settings, 463–464

popover views, 477–478

screen size, 8–9

splash screens for universal application, 464–465

split views, 465–477

displays, iPhone

screen size, 8–9

splash screens for universal application, 464–465

displays, iPod touch, 8–9

distributing apps

ad hoc deployment and testing, 104–407

overview of, 104

via App Store, 107–108

do-while loops, in C, 34

Document window

adding button bar to, 179

selecting navigation items, 168

UIApplication in, 118

documentation, 9–10

Documents directory

overview of, 350

reading/writing to, 350–351

documents, working with, 482

dynamic binding, 70

dynamic typing, 70

E

Edit button, editing tab bars, 142

Edit mode

accessing, 226

editing table rows, 228–236

methods, 226–227

table view in, 233

Editor pane, View button, 12

entities

attributes of, 402

in data model, 401–402

exercise adding to data model, 403–407

exercise fetching a group of entities, 412–414

fetching with NSFetchRequest, 409–410

NSManagedObject and, 409

relationships and, 402

events

creating and implementing, 404

handling methods in UIApplicationDelegate class, 122

exception handling

Objective-C, 74

throwing exceptions as a breakpoint, 95–96

Extended Markup Language (XML)

exercise preserving to XML property list, 355–357

Root.plist file, 331

F

fetching managed objects

from data models, 409–411

exercise fetching a group of entities, 412–414

field types, for application settings

overview of, 335

PSChildPaneSpecifier, 344–346

PSGroupSpecifier, 335

PSMultiValueSpecifier, 338–340

PSSliderSpecifier, 342–343

PSTextFieldSpecifier, 335–337

PSToggleSwitchSpecifier, 340–341

file sharing, enabling, 482

File’s Owner, removing connection between view and, 93

Firefox SQLite Manager plug-in, creating database with, 372–376

Fixed Space Bar Button Item, adding controls to toolbars, 271, 273

Flexible Space Bar Button Item, adding controls to toolbars, 271

for loops, in C, 34

formats, audio, 437

Foundation framework, 6

functions, declaring, 29, 35–36

G

garbage collection, iPhone/iPad limitations, 9

graphical user interface (GUI), 128

grouped table style

exercise grouping tables, 202–205

overview of, 189, 202

groups, exercise fetching a group of entities, 412–414

GUI (graphical user interface), 128

H

header file, creating, 29–31

Home button, suspending applications and, 368

Home directory

NSHomeDirectory, 351

overview of, 350

I

IBOutlets, 117

icons

creating universal application (for iPad or iPhone), 464–465

specifying for applications, 332

id variable type, 69–70

if statements, in C, 34

image pickers

delegates, 319–320

exercise managing camera and photo library, 318–319

exercise using, 320–326

image views

adding to canvas, 383

creating non-rectangular, 249–250

loading into pickers, 316–320

images

on buttons, 265–266

exercising using custom images on buttons, 266–270

loading image views into pickers, 316–320

in tables, 207–208

@implementation compiler directive, 44

implementation, Objective-C

anatomy of, 46–47

example generating, 43–44

overview of, 42

#import statement, compiling and, 31–32

#include statement, compiling and, 31–32

indexes

exercise using, 205–207

plain tables and, 201

using with Music application on iPod, 187

individual membership, iPhone Developer, 80

Info Dark button, 271–272

Info Light button, 271–272

inheritance, Objective-C

overriding methods allowed, 70–71

overview of, 70

init method, Objective-C, 52–53

insert method, SQLite

inserting records, 390–392

overview of, 387

installing iPhone apps, 79–80

instance methods, Objective-C, 50–51

instance variables

declaring, 44

memory management and, 57–58

public, private, and protected variables, 48

writing methods that set, 62–63

Instruments

exercise finding memory leak on iPhone

simulator, 102–104

overview of, 101

Interface Builder

creating empty XIB Interface Builder, 111

creating simple web browser, 292

customizing table cells, 214–218

editing interface with, 12

IBOutlets and IBActions and, 130

modifying segmented control in, 287

setting keyboard style, 280

setting text view properties, 286

UIView classes and, 128

@interface compiler directive, 44

interface, Objective C

anatomy of, 46–47

example generating, 43–44

overview of, 42

interface, Xcode

editing, 12

overview of, 11–12

saving changes to, 15

interruptions, handling interruptions to UIApplication, 123–126

iOS Application Programming Guide, 9

iOS Development Guide, 9

iOS frameworks, list of, 6–8

iPad

App Store and, 8

connecting to external display, 481–482

creating a universal application, 460

device technology layers, 5–6

exercise adding a split view, 465–477

exercise building an app for iPad and iPhone, 460–462

exercise centering MoviePlayer on iPad screen, 478–481

handling changes to orientation, 463–464

icons and default screens, 464–465

key skills and concepts, 458–460

limitations of, 8–9

movies in a view, 478

popover views for information or editing, 477–478

split views, 465

summary, 483

working with documents, 482

iPad Programming Guide, 9

iPhone

App Store and, 2

debugging iPhone apps. See Debugger

deploying apps to, 83–88

device technology layers, 5–6

exercise building an app for, 460–462

installing apps, 79–80

iPad compared with, 458–460

limitations of, 8–9

Mail application, iPhone, 260

managing camera with UIImagePickerController, 318–319

multimedia and, 436

notifications and, 326–328

provisioning process for apps, 82–83

registering apps, 80–81

testing apps for, 101–104

iPhone Dev Center

membership in, 79–80

registering with, 4–5

iPhone Developer membership, 79–80

iPod

App Store and, 2

More tab on iPod application, 144

multimedia and, 436

screen size, 8–9

use of tab bars for data views, 142–143

using with Music application on iPod, 187

iPodMusicPlayer, 444

items

adding to table view, 235

bar button items. See UIBarButtonItem

media items, 442–445

navigation items. See UINavigationItem

tab bar items, 144, 147–148

iTunes

distributing apps via App Store, 107–108

downloading apps from App Store, 2

iOS 3.0 and, 436

iTunes Connect Account, 107

J

JavaScript, web views and, 289

K

keyboards

setting type for text field, 281

styles, 280

L

labels

adding, 15–16

adding to toolbars, 273

adding to view, 300

connecting to an IBOutlet, 20

landscape orientation, using iPad in, 463

last in first out (LIFO), stacks and, 163

leaks

exercise finding memory leak, 102–104

in Instruments, 101–102

life cycle

handling application life cycle events, 121–123

Views for managing, 137–140

LIFO (last in first out), stacks and, 163

loops, in C, 34

M

Mail application, iPhone, 260

main function, C language, 27

main.m file, UIApplicationDelegate class, 120–121

MainWindow.xib

adding navigation controller to, 163–164

loading, 118–119

managed objects. See also model, of data objects

adding navigation and editing for a group of, 417–423

creating new, 415

exercise fetching a group of entities, 412–414

fetching from data models, 409–411

updating and deleting, 416

manual memory management, iPhone/iPad limitations, 9

media data classes, 442–443

Media layer, iPhone/iPad device technology layers, 5–6

media picker, 445–451

Media Player, exercise using, 445–451

Media Player Framework

developing music player with, 436

exercise using media picker and Media Player, 445–451

media data classes, 442–443

overview of, 442

playing music with MPMusicPlayerController, 444–445

selecting media items, 443–444

membership, in iPhone Developer Program, 79–80

memory, iPhone/iPad limitations, 8

memory management

example using manual memory management, 55–57

exercise finding memory leak, 102–104

with instance variables, 57–58

methods, 53–55

using autorelease, 58–59

memory-resident applications, iPhone/iPad limitations, 9

messaging, with Objective-C

nesting messages, 49–50

overview of, 48–49

self keyword used in messages, 49

methods

AutorotateToInterfaceOrientation, 463–464

AVAudioPlayerDelegate, 439

Edit mode, 226–227

event handling, 122

NSManagedObject accessors, 406

rollback, 415–416

save, 415–416

UIApplicationMain, 121

UITableView, 190

methods, Objective-C

alloc and init methods, 52–53

autorelease, 58–59

categories and, 72

class and instance methods, 50–51

dealloc, 66

declaration and definition, 44–45

memory management, 53–55

overloading not allowed, 71

overriding methods, 70–71

retain, 57

sayGoodBye class method example, 51–52

sayHello method example, 45–46

writing methods that set instance variables, 62–63

methods, SQLite

bind, 386–387

insert, update, and delete, 387, 390–395

sqlite3_preparev2, 377

sqlite3_step, 378

model instance, in Core Data, 408–409

model, of data objects

attributes, 402

deleting managed objects, 416

entities, 401–402

exercise adding entities and relationships to model, 403–407

fetching managed objects from, 409–411

NSManagedObjectModel, 408

overview of, 401

relationships, 402

saving changes to model data, 415–416

sorting fetched objects, 411

updating managed objects, 416

model, view, controller (MVC) design pattern, 384

More tab

allowing users to customize tab bars, 151

displaying additional tab bars, 142, 144

movies

exercise playing video, 452–454

in iPad view, 478

playing with MPMoviePlayerController, 451–452

MP3s, exercise playing, 439–442

MPMediaItem

initializing media collection, 444–445

as media data classes, 442–443

MPMediaItemCollection, 442–443

MPMediaLibrary, 442

MPMediaPickerController

as media data classes, 442

playing multimedia, 444–445

selecting media items, 443–444

MPMediaPickerControllerDelegate, 443–444

MPMediaQuery

initializing media collection, 444

as media data classes, 442

MPMoviePlayerController

exercise centering MoviePlayer on iPad screen, 478–481

playing video with, 451–454

MPMusicPlayerController

as media data classes, 442

playing music with, 444–445

multimedia

AudioServicesPlaySystemSound, 437

AVAudioPlayer and AVAudioPlayerDelegate, 438–439

exercise playing a sound and an MP3, 439–442

exercise playing video, 452–454

exercise using media picker and Media Player, 445–451

key skills and concepts, 436

media data classes, 442–443

Media Player framework, 442

playing music with MPMusicPlayerController, 444–445

playing sounds, 436

playing video with MPMoviePlayerController, 451–452

selecting media items, 443–444

summary, 452–454

multiple-argument messages, Objective-C, 67–69

multitasking, saving application state while, 368

music application with index, on iPod, 187

MVC (model, view, controller) design pattern, 384

N

navigation

adding for a group of managed objects, 417–423

adding for a list of items within a group, 424–427

creating navigation-based application, 403

navigation bars

adding additional view to, 172–176

adding buttons to, 169

building a three-view application using, 163–172

classes related to, 162

configuring, 177–178

key skills and concepts, 160–161

in Notes application, 186–187

overview of, 162

popping view controllers, 177

summary, 183

using navigation controller in tabs, 178–182

using with tables, 219–225

Utility application using, 176–177

navigation controllers

adding additional view, 172–176

building a three-view application using, 163–172

changing between views, 165

configuring navigation bars, 177

connecting to navBarController, 181

connecting to outlets, 166

overview of, 162

popping view controllers, 177

uses of, 160–161

using in tabs, 178–182

using tables in navigation controller in a tab, 219–225

navigation items

changing title of, 179

displaying title of, 173

selecting, 167–168

nested arguments, in Objective-C messages, 49–50

New Project dialog, 10, 27–28

nibs, IBOutlets and IBActions and, 130

non-rectangular view, creating, 249–250

nonatomic, description of property attributes, 63

Notes application

UITableView and UINavigationBar in, 186–187

use of navigation bars by, 162

NSArray

exercise preserving as property list, 352–354

saving as property list, 352

NSCoding protocol

adopting archiving protocols, 358–359

archiving/unarchiving an object, 360

archiving/unarchiving an object hierarchy, 364

NSCopying protocol

adopting archiving protocols, 358–359

archiving/unarchiving an object, 360

archiving/unarchiving an object hierarchy, 364

overview of, 65

NSData

loading blob into, 385–386

saving as property list, 352

NSDate, UIDatePicker and, 297, 299

NSDateFormatter, UIDatePicker and, 299

NSDictionary, saving as property list, 352

NSEntityDescription. See also entities entities in data model, 401

exercise fetching a group of entities, 412–413

retrieving (fetching) set of objects from Core Data, 409

NSException, exception handling with, 74

NSFetchedResultsController, 409

NSFetchRequest

predicates restricting data returned by, 410–411

retrieving (fetching) set of objects from Core Data, 409–410

NSHomeDirectory, 351

NSKeyedArchiver, 359–360

NSKeyedUnarchiver, 360

NSManagedObject

accessor methods generated at runtime, 406

creating subclasses rather than object instances, 415

deleting entities, 416

instantiation and persistence of, 401–402

overview of, 409

NSManagedObjectContext

deleting entities, 416

overview of, 409

undoing changes to model data, 416

NSManagedObjectModel, 408

NSMutableArray, 364, 367

NSNotification, 326–328

NSNumber

archiving/unarchiving an object, 360

saving as property list, 352

NSObject

converting primitive types to, 352

dealloc method, 66

NSPersistentStoreCoordinator, 408–409

NSPredicate, 410–411

NSPropertyListSerialization, 354–355

NSSearchPathForDirectoriesInDomains, 351

NSSortDescriptor

exercise fetching a group of entities, 412–413

sorting fetched objects, 411

NSString

archiving/unarchiving an object, 360

saving as property list, 352

NSTemporaryDirectory, 351

NSTimer, 251

NSUndoManager, 416

NSURL, 437

NSUserDefaults

changing settings while application suspended, 346

for reading application settings, 346

number pad

exercise using text field with, 282–285

keyboard styles, 280

O

Object Allocations, in Instruments, 101

Object Connection Inspector, 18

object graph, mapping relationships in object models, 400–401

Object Library

accessing, 14

hiding, 15

object-oriented programming. See Objective-C

Objective-C

alloc and init methods, 52–53

assigning properties, 64–65

C language and, 26

categories, 72

class and instance methods, 50–51

classes and objects, 42

compiler directives, 44

copy attribute, 65–66

dynamic typing, 70

example using manual memory management, 55–57

exception handling, 74

id variable type, 69–70

inheritance, 70

interface and implementation anatomies, 46–47

interface and implementation of classes, 42–44

key skills and concepts, 42, 62

memory management methods, 53–55

memory management using autorelease, 58–59

memory management with instance variables, 57–58

method declaration and definition, 44–45

multiple-argument messages, 67–69

nesting messages, 49–50

overloading methods, 71

overriding methods, 70–71

properties, 62–64

protocols, 72–74

public, private, and protected variables, 48

releasing properties, 66

relevant documentation, 9–10

retaining properties, 64

sayGoodBye class method example, 51–52

sayHello method example, 45–46

self keyword used in messages, 49

simple messaging with, 48–49

summary, 59, 75

Objective-C for iPhone Developers: A Beginners Guide (Brannan), 26

Objective-C for iPhone Programmers: A Beginner’s Guide (Brannan), 75

objects

blob (binary large object), 385–386

copying, 65–66

deallocating, 97–98

exercise archiving and unarchiving an, 360–363

exercise archiving and unarchiving an object hierarchy, 364–367

managed. See managed objects

Objective-C, 42

pushing/popping to/from stacks, 163

OpenGL, ES, and System Usage, in Instruments, 101

opening SQLite database, 376, 385

opening Xcode, 10

operators, C language, 33

orientation settings

handling changes to orientation on iPad, 463–464

split views and, 465

OS layers, 5–6

outlets

connecting navigation controller to, 166

connecting views to activity indicators, 242

IBOutlets, 130

overloading methods, 71

overriding methods, 70–71

P

persistence store

in Core Data, 400–401

NSPersistentStoreCoordinator, 408–409

querying with NSFetchRequest, 409–410

saving changes to model data, 415–416

Phone pad, keyboard styles, 280

Photo application, action sheet in, 252

photo library, managing, 318–319

pickers

data sources, 307–308

date pickers, 296–299

delegates, 307

exercise using date picker, 299–303

exercise using date picker in Timer mode, 303–306

exercise using image picker controller to manage camera and photo library, 320–326

exercise using picker views to select values, 308–312

exercise using picker views with images, 316–320

exercise using picker views with two components, 312–316

media picker, 443–444

notifications and, 326–328

overview of, 306–307

picker views, 306–308

summary, 328

pixels, screen sizes and, 8–9

plain table style

indexing tables and, 205–207

overview of, 189, 201

playing sounds. See audio

playing video. See video

PNG (Portable Network Graphics), 332

pointers, C language

dereferencing, 38

overview of, 36–37

using, 37–38

using with arrays, 39

popover views, iPad, 477–478

popping, removing objects from stacks, 163

Portable Network Graphics (PNG), 332

portrait orientation, using iPad in, 463

predicates, restricting data returned by NSFetchRequest, 410–411

Preferences directory, 350

preprocessor statements, C language

overview of, 31

using, 31–32

primitive types, converting to NSObjects for serialization, 352

printf statement, outputting with, 36

@private compiler directive, 48

private variables, declaring, 48

processor speed, iPhone/iPad limitations, 8

Programming in Objective-C 2.0 (Kochan), 75

progress bars

exercise using, 244–251

function of, 238

showing progress with, 244

summary, 261

projectors, connecting iPad to, 481

properties, Objective-C

assigning, 64–65

copying, 65–66

overview of, 62–64

releasing, 66

retaining, 64

@property compiler directive, 63

property lists

exercise preserving NSArray as, 352–354

exercise preserving to XML property list, 355–357

NSPropertyListSerialization, 354–355

overview of, 351–352

serialization and, 352

summary, 369

@protected compiler directive, 48

protected variables, declaring, 48

protocols

adopting NSCoding and NSCopying protocols, 358–359

Objective-C, 72–74

prototypes, function signatures and, 29

Provisioning Portal

App IDs tab, 82

Certificates tab, 80

Devices tab, 81

Provisioning Profile tab, 83

provisioning process, for iPhone apps, 82–83

Provisioning Profile tab

overview of, 82–83

provisioning process, 84–86

PSChildPaneSpecifier

adding, 344–346

overview of and list of settings, 344

PSGroupSpecifier, 335

PSMultiValueSpecifier, 338–340

PSSliderSpecifier, 342

PSTextFieldSpecifier

adding, 336–337

list of settings, 336

overview of, 335

PSToggleSwitchSpecifier

adding, 340–341

overview of and list of settings, 340

@public compiler directive, 48

public variables, declaring, 48

pushing, placing objects on stacks, 163

Q

queries, SQLite database, 385

Quick-start example, 10–23

R

readonly, property attribute, 63

readwrite, property attribute, 63

records, SQLite

adding using SQLite Manager, 375

deleting, 395–397

inserting, 390–392

selecting, 378

updating, 392–395

registration, of apps, 80–81

relationships

in data model, 402

exercise adding, 403–407

specifying between group and subgroup, 407

release method

description of property attributes, 63

memory management, 54–55

overview of, 66

resolution, screen size and, 8–9

retain method

description of property attributes, 63

memory management, 53–55

retaining instance variable, 57

using properties with, 64

return key, keyboard settings, 281

Ritchie, Dennis, 26

rollback method, undoing changes to model data, 415–416

Root.plist

adding, 341

PSChildPaneSpecifier, 344

PSMultiValueSpecifier, 339

PSSliderSpecifier, 343

PSTextFieldSpecifier, 337

in settings bundle, 331

Round Rect button, 270

rows, in tables

deleting and moving, 233–234

editing, 228–236

handling row selections, 224–225

height settings, 210–211

selecting, 209–210

S

save method, saving changes to model data, 415–416

screen size. See also displays

external displays on iPad and, 482

iPhone/iPad limitations, 8–9

scrolling, 129

SDK (Software Development Kit)

how to obtain, 4–5

prerequisites to downloading, 79

security, iPhone/iPad limitations, 9

segmented controls, 287–289

select statement, selecting records from SQL database, 378

self keyword, in Objective-C messages, 49

serialization

NSPropertyListSerialization, 354–355

property lists and, 352

Settings application. See also application settings

adding application settings to, 330

MySettings interface on iPhone simulator, 333

overview of, 331

settings bundles

creating, 332–334

reading, 347–348

types of files in, 331–332

shallow copies, 65

short-lived applications, iPhone/iPad limitations, 9

signatures, function names, 29

simulator, iPad

with full-screen display, 462

with iPhone sized display, 459

simulator, iPhone

allowing users to customize tab bars, 153–156

exercise finding memory leak, 102–104

running three-tab application in, 148

running two-tabbed application in, 151

starting application, 20–21

viewing newly created application in, 116

sliders

adding controls to toolbars, 271

exercise using, 277–280

overview of, 276–277

properties, 277

Software Development Kit (SDK)

how to obtain, 4–5

prerequisites to downloading, 79

sorting, objects retrieved from data models, 411

sounds. See audio

spacers, adding to toolbars, 274

spell checking, 280

split views

exercise adding, 465–477

overview of, 465

popover views and, 477

SQLite database

adding, 372

basic data manipulation, 376

bind methods, 386–387

closing, 386

deleting records, 395–397

exercise creating, 372–376

insert, update, and delete methods, 387

inserting records, 390–392

key skills and concepts, 372

loading, 379–384

loading blob into NSData, 385–386

MVC design pattern and, 384

obtaining column values, 378

opening, 376

opening and querying, 385

preparing and executing statement, 377–378

return codes, 376

selecting records, 378

summary, 397

updating records, 392–395

working with records, 388–390

SQLite Manager plug-in, for Firefox, 372–376

sqlite3_open command, 376

sqlite3_preparev2 method, 377

sqlite3_step method, 378

sqlite3_stmt, 377

stacks, 163

state

saving application state while multitasking, 368

selecting button’s state, 268

statements, preparing and executing SQLite statements, 377–378

status bars, 160

stepping through code, with Debugger, 91

structures (structs), 35

styles

activity indicators, 240

keyboard, 280

styles, tables

exercise grouping tables, 202–205

indexing tables, 205–207

overview of, 201

UITableViewStyleGrouped, 189, 202

UITableViewStylePlain, 189

switch statements, in C, 34

switches

adding controls to toolbars, 271

exercise using a switch and a slider, 277–280

overview of, 276

SystemSoundID, 437, 440

T

Tab Bar Application template, 145–146

tab bar controller, 144

tab bar controller delegate, 144

tab bar items

adding tab bar items to tab bar

applications, 147–148

individual tabs, 144

tab bars

adding items to, 147–148

allowing users to customize, 151–156

classes related to, 142–144

creating tab bar application from scratch, 148–151

creating tab bars, 144

exercise using Tab Bar Application template, 145–146

key skills and concepts, 142

navigation controller used in tabs, 178–182

summary, 156–157

using with tables, 219–225

table view controllers

creating and managing table views with, 191–194

exercise using, 198–201

overview of, 189, 198

table view data sources

adding, 194–198

creating new class that adopts data sources, 191–194

methods, 190

overview of, 189

table view delegates

adding, 194–198

creating new class that adopts delegates, 191–194

methods, 190

overview of, 189

table view styles

grouped, 189, 202–205

plain, 189, 201, 205–207

table views

accessorizing cells, 211–213

adding, 191

adding delegates and data sources, 194–198

adopting UITableViewDelegate and UITableViewDataSource, 191–194

cells. See cells, in tables

customizing cells, 213–218

editing cells, 226–227

editing rows, 228–236

exercise grouping, 202–205

grouped table style, 202

images in, 207–208

indexing, 205–207

key skills and concepts, 186

in Music application, 187–188

navigation bars and tabs used with, 219–225

in Notes application, 186–187

row height options, 210–211

row selection, 209–210

rows. See rows, in tables

styles, 201

summary, 236

UITableView, 189

UITableViewController, 198–201

UITableViewDataSource, 189–190

UITableViewDelegate, 189–190

Targeted Device Family

setting to iPad, 461

setting to iPhone, 460

templates

Tab Bar Application template, 145–146

Utility Application template, 176–177

View-based Application template, 131–133

Window-based Application template, 133–137

testing iPhone apps, 101–104

text fields

adding controls to toolbars, 271

overview of, 280–281

using with a number pad, 282–285

text views, 286

@throw compiler directive, 74

timers

exercise using date picker in Timer mode, 303–306

NSTimer, 251

tmp directories

NSTemporaryDirectory, 351

overview of, 350

reading/writing to, 350–351

toggle buttons. See switches

toolbars

adding to canvas, 383

exercise creating, 273–275

overview of, 271–273

placing labels on, 273

translucent, making toolbars, 275

U

UIActionSheet

delegates, 257

exercise using, 257–260

function of, 238

in Photo application, 252

summary, 262

when to use, 251

UIActionSheetDelegate, 257

UIActivityIndicatorView

exercise using, 241–244

function of, 238

showing activity with, 239–240

styles, 240

summary, 261

UIAlertView

alerting users, 251

creating alert with multiple buttons, 256

creating simple alert, 254–255

delegates, 252–253

function of, 238

summary, 261–262

UIAlertViewDelegate, 252–253

UIApplication

adding UIView and UIViewController to UIApplicationDelegate, 110–117

connecting with UIWindow and UIApplicationDelegate, 117–118

handling application life cycle events, 121–123

handling interruptions, 123–126

loading MainWindow.xib, 118–119

overview of, 110

summary, 123–126

UIApplicationDelegate and, 119–121

UIApplicationDelegate

adding UIView and UIViewController to, 110–117

connecting with UIWindow, 117–118

event handling methods, 122

handling application life cycle events, 121

main.m file, 120–121

overview of, 119–120

UIApplicationMain method, 121

UIBarButtonItem

adding, 173

connecting button bar to actions, 175

toolbars for adding, 271

UIButton

button types, 270–271

exercising using custom images with, 266–270

with images, 265

UICatalog

buttons screen, 265

sample application, 264

UIControl, 129

UIDatePicker

Date mode, 300

exercise using, 299–303

exercise using in Timer mode, 303–306

NSDate values, 297, 299

NSDateFormatter, 299

overview of, 296–298

value changed event, 302

UIDocumentInteractionController, 482

UIFileSharingEnabled, 482

UIImagePickerController

delegates, 319–320

exercise managing camera and photo library, 318–319

exercise using, 320–326

UIImagePickerControllerDelegate, 319–320

UIImageView

adding to canvas, 383

creating non-rectangular view with, 249–250

loading image views into pickers, 316–320

UIKit framework

overview of, 6

UIView classes in, 129

UILabel, 300

UINavigationBar. See also navigation bars

in Notes application, 186–187

overview of, 162

UINavigationController. See also navigation controllers

adding additional view, 172–176

building a three-view application using, 163–172

configuring navigation bars, 177

connecting to navBarController, 181

overview of, 162

popping view controllers, 177

using navigation controller in tabs, 178–182

UINavigationItem

changing title of navigation item, 179

displaying title of, 173

selecting navigation items, 167–168

UIPickerView

data sources, 307–308

delegates, 307

exercise using a picker, 308–312

exercise using with two components, 312–316

loading image views into pickers, 316–320

overview of, 306–307

UIPickerViewDatasource, 307–308

UIPickerViewDelegate, 307

UIProgressView

exercise using, 244–251

function of, 238

showing progress with, 244

summary, 261

UIScrollView, 129

UISegmentedControl, 287–289

UISlider

appearance properties, 277

continuous property, 277

exercise using, 277–280

overview of, 276

values, 277

UISpllitViewController

exercise adding a split view, 465–477

overview of, 465

popover views and, 477

UISwitch

adding controls to toolbars, 271

exercise using, 276

exercise using a switch and a slider, 277–280

UITabBar

adding items to, 147–148

allowing users to customize, 151–156

classes related to, 142–144

creating tab bar application from scratch, 148–151

creating tab bars, 144

exercise using Tab Bar Application template, 145–146

key skills and concepts, 142

navigation controller used in tabs, 178–182

summary, 156–157

using with tables, 219–225

UITabBarController, 144

UITabBarControllerDelegate, 144

UITabBarItem

adding tab bar items to tab bar applications, 147–148

individual tabs, 144

UITableView. See also table views

adding to a view, 191

cells. See cells, in tables

in Music application, 187–188

in Notes application, 186–187

overview of, 189

rows. See rows, in tables

UITableViewController

creating and managing table views with, 191–194

exercise using, 198–201

overview of, 189, 198

UITableViewDataSource

adding, 194–198

creating new class that adopts data sources, 191–194

methods, 190

overview of, 189

UITableViewDelegate

adding, 194–198

creating new class that adopts delegates, 191–194

methods, 190

overview of, 189

UITableViewStyleGrouped, 189

exercise grouping tables, 202–205

overview of, 202

UITableViewStylePlain

indexing tables and, 205–207

overview of, 189, 201

UITextField

exercise using text field with a number pad, 282–285

overview of, 280–281

UITextView, 286

UIToolBar

adding to canvas, 383

exercise creating toolbars, 273–275

overview of, 271–273

placing labels on toolbars, 273

UIView

adding to UIApplicationDelegate, 110–117

application life cycle events and, 137–140

creating UITableView as subview of, 194

exercise using View-based Application template, 131–133

exercise using Window-based Application template, 133–137

IBOutlets and IBActions and, 130

overview of, 128

subclasses of, 129

summary, 140

view-based application template, 130

UIViewController

adding to UIApplicationDelegate, 110–117

application life cycle events and, 137–140

exercise using View-based Application template, 131–133

exercise using Window-based Application

template, 133–137

function of, 128

overview of, 129

UIWebView

delegates, 290–291

exercise creating simple web browser, 291–294

overview of, 289–290

UIWebViewDelegate, 290–291

UIWindow

connecting UIApplicationDelegate with, 117–118

using iPad with external display, 481

uniform resource locators (URLs)

CFURL and NSURL, 437

keyboard styles, 280

update method

managed objects, 416

SQLite records, 392–395

URLs (uniform resource locators) CFURL and NSURL, 437

keyboard styles, 280

user-friendly applications, 238

Utility application, navigation bars used with, 176–177

V

variables

id variable type, 69–70

instance variables. See instance variables

VGA display, connecting iPad to, 481

video. See also multimedia

exercise playing video, 452–454

playing video with MPMoviePlayerController, 451–452

View-based Application template, 131–133

view controllers

adding to UIApplicationDelegate, 110–117

application life cycle events and, 137–140

exercise using View-based Application template, 131–133

exercise using Window-based Application template, 133–137

function of, 128

overview of, 129

views

adding to UIApplicationDelegate, 110–117

application life cycle events and, 137–140

content views, 128

creating UITableView as subview of, 194

exercise using View-based Application template, 131–133

exercise using Window-based Application template, 133–137

IBOutlets and IBActions and, 130

removing from view controller, 93

subclasses of, 129

summary, 140

view-based application template, 130

W

watchpoints, setting in Debugger, 92–93

web views

delegates, 290–291

exercise creating simple web browser, 291–294

overview of, 289–290

while loops, in C, 34

Window-based Application template

creating tab bar applications from scratch, 148–151

exercise using, 133–137

Window-based Applications

building a three-view application, 163

creating in Xcode, 110

windows

connecting UIApplicationDelegate with UIWindow, 117–118

UIWindow for using iPad with external display, 481

www.appstoreapps.com, 3

X

Xcode

building for latest version of SDK (default), 86

code completion and preferences, 123–124

Code Sense in, 123

creating simple C program, 27–28

creating window-based application in, 110

debugging and testing tools, 88

downloading and installing, 4

interface for, 11–12

opening, 10

View-based application template, 130

XML (Extended Markup Language)

exercise preserving to XML property list, 355–357

Root.plist file, 331

Y

YouTube

customizing table rows and, 188

example of YouTube app with plain buttons, 266

Z

Zombie app, 98–101

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset