Index

Symbols

+ (plus), class methods, 101

- (dash), method declarations, 98

2.x support, adding to image selection, 263

3.1 support, adding to image selection, 263

@ (at) symbol, 92, 103

A

ABAddressBookCopyArrayOfAllPeople() function, 724

ABAdressBookCreate() function, 724

Abbott, Jay, 86

ABContact class, 738

ABContactsHelper class, 738

ABGroup class, 738

ABGroupAddMember() function, 737

ABGroupCreate() function, 736

ABGroupRemoveMember() function, 737

ABPeoplePickerNavigationController class, 742, 744

ABPeoplePickerNavigationControllerDelegate protocol, 743

ABPersonHasImageData() function, 733

ABRecordCopyValue() function, 728

ABRecordRef type, 724–725

ABRecordSetValue() function, 726, 730

ABUnknownPersonViewController, 750–752

accelerometer

detecting shakes, 605–608

locating “up,” 597–599

moving onscreen objects, 599–601

AccelerometerHelper class, 605

access points (Wi-Fi), 690

accessibility (VoiceOver)

adding from code, 802–803

adding with Interface Builder, 799–802

common VoiceOver gestures, 805–806

overview, 799

testing on iPhone, 803–804, 806

testing with simulator, 803

accessing

Address Book image data, 741–742

arrays, 133

camera, 148

device information, 589–590, 592–593

FTP sites, 586–587

SDKAPIs from Xcode, 50–51

sets, 135

substrings, 128–129

accessor methods, 105

accessory views

check marks in table cells, 446–448

disclosure accessories in table cells, 449–451

accounts, test accounts (StoreKit)

creating, 781–782

signing into, 790

action sheets

displaying text in, 405–406

menus, creating, 403–405

pop-ups versus, 403

actions

adding, 162

connecting buttons to, 347

ad hoc distributions, 83

applications, building, 84

artwork, adding, 84–85

devices, registering, 83

entitlement files, 83

mobile provisions, building, 83

Address Book

ABContact class, 738

ABContactsHelper class, 738

ABGroup class, 738

ABRecordRef type, 724–725

ABUnknownPersonViewController, 750–752

AddressBookUI framework, 724

contacts

adding, 747–748

adding random contact art, 752–754

limiting contact picker properties, 745–747

modifying, 748–750

picking people, 742–745

searching for, 735

groups, 736–738

images, 733–734, 741–742

overview, 723

properties

address and instant message properties, 730–733

date properties, 726–730

multivalue record properties, 727–730

records

adding, 734

creating, 734

deleting, 735–736

multivalue record properties, 727–730

retrieving and setting ABRecord strings, 725–726

referencing, 724

searching, 738–740

address book controllers, 150

address properties (Address Book), 730–733

AddressBookUI framework, 724

addSubview method, 29

affine transform of UIView, 233–234

alert sounds, creating, 418

alerts, 391, 673. See also progress indicators

application badges, updating, 416–417

audio alerts, 417–420

classes for, 394

creating, 391–392

delegate methods in, 392–394

displaying, 190–191, 394

localized alerts, 673

modal alerts, creating with run loops, 396–399

network activity indicators, 415–416

no-button alerts, creating, 394–396

orientable scroll-down alerts, creating, 412–415

requesting text input via, 399–402

tappable overlays, creating, 411–412

variadic arguments with, 402–403

volume alert, displaying, 420–421

allApplicationSubviews() function, 214

allocating memory, 94

allSubviews() function, 214

alternating table cell colors, 439–441

animations. See also transitions

in buttons, 351–354

view animations

bouncing views, 248–250

building UIView animation blocks, 236–237

callbacks, 237

Core Animation calls, 244–246

Core Animation transitions, 242–244

curl transitions, 246–247

fading views in and out, 237–238

flipping views, 240–241

image view animations, 250–251

overview, 236

swapping views, 239–240

annotations

map annotations

adding, 710

annotation views, 710–712

creating, 710

MapAnnotation class, 709–710

responding to annotation button taps, 712–716

user location annotations, 707–708

APNS (Apple Push Notification Service), 656

App Store

compiling clean builds for, 80–81

debugging uploads, 81–82

appending strings, 126

Apple Push Notification Service (APNS), 656

application approval for in-app purchase items (StoreKit), 785–786

application badges, updating, 416–417

application bundles, 257

components, 26–27

application folder hierarchy, 22–23

executable, 23

icon and default images, 25–26

Info.plist files, 23–25

NIB files, 26

loading images from, 258

application delegate, 20–21

application identifiers

editing, 66–67

generating for push notifications, 659

registering, 15

application limits, platform differences, 11

application registration for push notifications, 662–663

error handling, 664–665

responding to notifications, 665–666

retrieving device tokens, 663–664

applications. See also projects

IPA archives, 27

overview, 17–18

sandboxes, 27

sharing keychains between, 575–577

skeleton, 18–22

submitting for review, 787

applying image processing, 293–295

aps dictionary, 673–675

archiving, persistence through, 314–315

arguments, variadic arguments with alerts, 402–403

arrays, 133

accessing, 133

converting strings to, 128

converting to strings, 134

creating, 133

NSArray class, 97

NSMutableArray class, 97

for table sections, creating, 468–469

testing, 134

view controller arrays, loading, 198

artwork, adding to ad hoc distributions, 84–85

assembling applications

application skeleton, 18–19

application delegate, 20–21

main.m file, 19–20

view controller, 21–22

overview, 17–18

assigning

data sources for tables, 425–426

delegates for tables, 426

properties, 109

retained, 113–114

self-assigning, 112

asynchronous downloads, 560–565

at (@) symbol, 92, 103

atomic methods, 109

attributes

Core Data, 758

of properties, 109–110

audio

handling interruptions, 621–622

ignoring lock events, 622–624

iPod library contents, filtering, 645–649

looping, 618–620

picking, 641–645

playing, 611, 615–618

catching end of playback, 614

initializing audio players, 611–612

monitoring audio levels, 613

with MPMusicPlayerController class, 649–653

scrubbing audio, 614

recording, 624–628

with Audio Queues, 629–634

audio alerts, 417

alert sounds, creating, 418

system sounds, creating, 417–420

vibration, creating, 418

audio players, initializing, 611–612

Audio Queues, 417, 629–634

Audio Services, 418–420

authentication challenges, handling, 565–566

autorelease memory management, 58

autorelease objects

creating, 111–112

explained, 110–111

lifetime of, 112

retaining, 112–113

autorelease pools, 19–20

autosizing, 176–179

text editors, 372

availability, checking, 555–557. See also reachability

availability date, setting, 781

AVAudioPlayer class, 417, 611. See also audio

catching end of playback, 614

initializing audio players, 611–612

monitoring audio levels, 613

playing audio, 615–618

scrubbing audio, 614

AVAudioRecorder class, 624

AVAudioSession class, 624

B

background color of tables, changing, 430–432

background images for tables, creating, 432–433

badges, 673

application badges, updating, 416–417

Ballard, Kevin, 388

bar button items, 347

bars, 146–147

battery state, monitoring, 594–595

behavior limits, platform differences, 12

bitmaps, 291

applying image processing, 293–295

drawing into bitmap contexts, 291–293

image-processing limitations, 295–297

testing touches against bitmap alpha levels, 309–311

Bluetooth, GameKit and, 495

limitations, 496–497

Bonjour, 495

GameKit sessions and, 496, 498

iPhone servers

creating, 515–520

Mac clients, creating, 520–523

names and ports, registering, 528–529

scanning for services, 540–543

BonjourHelper class, 528–537

bookmarks, 76–77

bouncing views, 248–250

bounded movement, 306–307

bounded views, moving randomly, 231–232

breakpoints, 53–55

Britten, Ben, 629

browsing parse trees, 580–582

buffers, NSData class, 136

built-in controls in table cells, 441–443

Bundle Seed IDs, 16

buttons, 344–345

adding in Interface Builder, 345–347

animation in, 351–354

connecting to actions, 347

custom buttons

building in Xcode, 348–351

creating, 346–347

multiline button text, 351

in segmented controls, 362–363

toggle buttons, 354–356

C

C programming language, 91, 116

C strings, converting to/from, 127

caching, 768

memory management, 59

monitoring with Instruments application, 62–64

calculating lines, 323–325

callbacks

adding to protocols, 123

animation callbacks, 237

optional callbacks, 123–124

camera. See also images

accessing, 148

capturing time-lapse photos, 273–275

custom camera overlays, 275, 277–278

model differences, 7

selecting and customizing images from camera roll, 265–267

snapping photos and writing to photo album, 268–270

camera roll, selecting and customizing images from, 265–268

canceling peer picker alerts, 499

capability requirements, adding, 590–592

capturing

colors, 165

time-lapse photos, 273–275

Carbon, explained, 117

case (of strings), changing, 129

catching end of audio playback, 614

categories, explained, 120–121

cell tower positioning, 690

cells (table)

adding, 453

alternating colors, 439–441

building custom, 435–439

with built-in controls, 441–443

check marks in, 446–448

deleting, 451–456

disclosure accessories in, 449–451

removing selection highlights, 448–449

reordering, 456–457

retaining state, 443–445

returning from sections, 470

reusing, 425, 428

selection color, setting, 429

swiping, 453

types of, 433–435

visualizing reuse, 445–446

centering landscape views, 234–235

certificates, 14

CFShow function, 105

CGFont class, 388

CGRect structure, 223–224, 227

CGRectCreateDictionaryRepresentation() function, 223

CGRectFromString() function, 223, 313

CGRectGetCenter() function, 227

CGRectInset() function, 223

CGRectIntersectsRect() function, 223

CGRectMake function, 223

CGRectMoveToCenter() function, 227

CGRectZero() function, 223

chat, 512–515

check marks in table cells, 446–448

chevrons, 449–451

child-view undo support, 316

choices, views for, 145

chunked data for asynchronous downloads, 562

circles, detecting, 325–327

circular hit test, 308

Clang static analyzer, 64–65, 98

class headers, inspecting, 163

class methods, 101

classes. See also Foundation classes

for alerts, 394

explained, 92–93

extending, 120–121

hierarchy, 102–103

implementing, 100

logging information, 103–105

naming in Cocoa Touch, 92

for progress indicators, 406–407

clean builds, 80–81

clearing console log, 56–57

CLHeading class, 698

client mode (peer pickers), 500, 502

client skeleton example (push notifications), 667–672

clients

in GameKit, 498

Mac clients, creating for iPhone Bonjour servers, 520–523

clipboard for simulator, 48, 524–525

CLLocation class, properties, 694–695

closing connections with BonjourHelper class, 530

Cocoa, explained, 117. See also Foundation classes

Cocoa Touch

class names, 92

definition of, 4–5

explained, 117

CocoaDev Web site, 816

code, adding VoiceOver accessibility from, 802–803

code signing identity, setting, 67–68

code-based temperature converter example, 166–169

collapsing methods, 77

collections, 133–136

arrays, 133–134

dictionaries, 134–135

fast enumeration, 101

memory management, 135

sets, 135

writing to files, 135–136

color

background color of tables, changing, 430–432

capturing, 165

selection color for table cells, setting, 429

of table cells, alternating, 439–441

com.yourcompany, overriding, 86

comparing dates, 131

compiler directives

explained, 73–74

iPhone-specific definitions, recovering, 74–75

pragma marks, 76–77

runtime checks, 75–76

compiler warnings

message forwarding, 140

treating as errors, 98

compiling

applications, 68–69

clean builds for App Store, 80–81

complex data, sending via GameKit, 510–512

compound predicates in fetch requests (Core Data), 771

computing speed and distance, 696–697

configurations, creating/editing distribution configurations, 78–79

conforming to protocols, 124–125

connecting buttons to actions, 347

connection process, GameKit peers, 498–500, 502

connections

adding, 163–164

asynchronous downloads, 560–565

authentication challenges, handling, 565–566

closing with BonjourHelper class, 530

connectivity changes, scanning for, 549–552

data uploads, 572–575

FTP access, 586–587

GameKitHelper class, 503–504

IP and host information, retrieving, 552–555

network activity indicators, 415–416

network status, checking, 545–547

online connections, creating with GameKit, 537–540

peer-to-peer connections. See Bonjour; GameKit

POST requests, uploading via, 569–572

site availability, checking, 555–557

synchronous downloads, 557–560

UIDevice class, extending for reachability, 547–549

WiFi connections with BonjourHelper class, 528–537

connectivity changes, scanning for, 549–552

console

clearing log, 56–57

running, 55–56

Console tab (Organizer), 72

constraining movement, 305, 307

consumable purchases, 784

Contact Add button, 344

contacts (Address Book)

ABUnknownPersonViewController, 750–752

adding, 747–748

adding random contact art, 752–754

limiting contact picker properties, 745–747

modifying, 748–750

picking people, 742–745

searching for, 735

content length for asynchronous downloads, 562

contents controllers, 149

contexts (Core Data)

creating, 760–761

inserting entities into, 761–763

controller behavior

delegation, 30–31

notifications, 33

overview, 30

target-actions, 32

controls, 145–146, 341

buttons, 344–345

adding in Interface Builder, 345–347

animation in, 351–354

building in Xcode, 348–351

connecting to actions, 347

creating custom buttons, 346–347

multiline button text, 351

events, 341–344

page indicators, 376–383

remove controls, displaying/dismissing, 452

segmented controls, 362–363

sending events, 364

sliders, custom slider thumbs, 356–361

subclassing UIControl class, 363–366

switches, 354–356

in table cells, 441–443

text fields

dismissing keyboards, 366–369

text entry filtering, 374–376

text views

creating text editors, 371–374

dismissing keyboards, 370–371

smart labels, 387–388

toolbars

creating in Interface Builder, 384–385

creating in Xcode, 385–386

tips for, 387

types of, 341

convenience methods, 111

conversion method, defining, 165–166

converting

aps dictionary to JSON, 674–675

arrays to strings, 134

C strings, 127

Interface Builder files to Objective-C, 51–53

strings to arrays, 128

XML data to tree data structures, 577–582

coordinate systems, 224

Core Animation

calls, 244–246

transitions, 242–244

Core Data

contexts, creating, 760–761

explained, 757–758

header files, generating, 759–760

model files, creating/editing, 758

objects

creating, 761–763

removing, 765–767

retrieving, 763–764

search tables example, 770–772

table data sources example, 767–770

table editing example, 773–775

table undo/redo support example, 775–778

Core Foundation

explained, 117

memory management, 116–117

Core Graphics, masking reflections with, 253–255

Core Location

cell tower positioning, 690

computing speed and distance, 696–697

detecting direction of north, 698–700

GPS positioning, 690

hybrid positioning approaches, 691

Internet provider positioning, 691

model differences, 8

overview, 689

SkyHook Wi-Fi positioning, 690

tracking latitude and longitude

code listing, 693

location properties, 694–695

step-by-step process, 691–692

tracking speed, 695–696

counting table sections/rows, 469–470

Cox, Brad J., 91

Crash Logs tab (Organizer), 72–73

credentials, 566–569

cross-promotion, 815

curl transitions, 246–247

custom buttons. See also buttons

building in Xcode, 348–351

creating, 346–347

custom camera overlays, 275, 277–278

custom getters/setters, creating, 107–109

custom key-value pairs in notification payloads, 675

custom modal controllers example, 199–201

custom overlays for progress indicators, creating, 409–411

custom popping options example (navigation controllers), 197–199

custom settings bundles, adding, 806–807

avoiding sensitive information, 808

checking user defaults, 813–814

creating custom settings page, 810–813

defining settings bundle, 809

Llama Settings project, 813

Settings app, 807

settings schema, 808

custom slider thumbs, 356–361

custom table cells, building, 435–439

custom templates, creating, 86–88

custom undo routine, 318–319

customized paged scroller example, 379–383

customizing

images from camera roll, 265–268

selected table cells, 439

table headers/footers, 474–476

toolbars, 56–57

Xcode identities, 85–86

cylinder roll example (picker views), 484–487

D

dash (-), method declarations, 98

data access limits, platform differences, 10

data display, views for, 144

data handling, GameKitHelper class, 504–505

data length, checking in GameKit, 523–527

data retrieval via pasteboards, 525

data sharing via pasteboards, 524

data source methods, building searchable, 465–466

data sources, 34–35

explained, 122

for tables

assigning, 425–426

methods, 427–428

data storage via pasteboards, 524

data structures for table sections, creating, 468–469

data uploads, 572–575

date properties (Address Book), 726–730

date/time

entering in tables, 487–490

formatting, 490–493

NSDate class, 131–132

NSDateFormatter class, 132

deallocating objects, 117–119

example, 119

retained properties, 118

variables, 118

debugger, 53

breakpoints, 53–55

console, 55–57

customizing toolbars, 56–57

objects, inspecting, 55

opening, 53

running, 53

zombies, enabling, 57

debugging

App Store uploads, 81–82

tethered debugging, overview, 6–7

declaring

interfaces, 92

methods, 98–99

optional callbacks, 123–124

URL, 815–816

default settings, checking user defaults, 813–814

Default.png files, 25–26

defining

conversion method, 165–166

protocols, 122–123

settings bundle, 809

delays

in registering purchases (StoreKit), 794

in system sounds, 419

delegate methods

alerts, 392–394

assigning for tables, 426

table searches, 467

table sections, 472

delegation, 30–31, 122

delete rules (Core Data), 766

deleting. See removing

deployment

application identifiers, editing, 66–67

code signing identity, setting, 67–68

compiling applications, 68

development provisions, installing, 66

signing applications, 68–69

deselecting table cells, 448

deserializing property lists, 510–512

Detail Disclosure button, 344

Detail pane (Xcode projects), 41–42

detecting

circles, 325–327

device orientation, 601–603

direction of north, 698–700

leaks with Instruments application, 59–60, 62

multitouch, 327–329

shakes

with accelerometer, 605–608

with motion events, 603–604

developer portal

overview, 13

provisioning, 16

registering application identifiers, 15

registering devices, 14–15

requesting certificates, 14

setting up teams, 13–14

developer programs. See also developer portal

Enterprise Developer Program, 2

Online Developer Program, 2

registering for, 3

Standard Developer Program, 2

table of, 1–2

University Developer Program, 3

development devices, 5

development process for push notifications, 659

application identifier, generating, 659

push-specific provisions, 661–662

SSL certificate, generating, 660–661

development provisions, installing, 66

device capability requirements, adding, 590–592

device information, accessing, 589–590, 592–593

device orientation, detecting, 601–603

device tokens

managing inactive, 685–686

retrieving, 663–664

devices, registering, 14–15, 83

Devices list (Organizer), 71

dictionaries, 133–135

creating, 134

listing keys, 135

removing objects, 135

replacing objects, 134

searching, 134

direct manipulation interfaces. See also touches

calculating lines, 323–325

detecting circles, 325–327

gesture distinction, 329–333

interactive resize and rotation, 333–338

multitouch, 303–304, 327–329

persistence, 311–315

simple direct manipulation interface, 304–305

touch-based painting, 321–323

undo support, 316–320

direction of north, detecting, 698–700

direction sensing

locating “up,” 597–599

moving onscreen objects, 599–601

directives. See compiler directives

disabling proximity sensor, 596–597

disclosure accessories in table cells, 449–451

disconnections

BonjourHelper class, 530

GameKitHelper class, 503–504

disk space, checking, 608–609

dismissing

keyboards, 366–371

remove controls, 452

displaying

alerts, 190–191, 394

data, views for, 144

images in scrollable view, 278–280

multiimage paged scroll, 280–281

remove controls, 452

text in action sheets, 405–406

volume alert, 420–421

peer picker, 498–499

distance, computing, 696–697

distribution configurations, creating/editing, 78–79. See also ad hoc distributions

Documents folder, saving images to, 270–271

dot notation, 105

double-taps, 330

downloads

asynchronous downloads, 560–565

iPhone SDK, 3

synchronous downloads, 557–560

draggable views, creating, 304–305

drags, 330

drawing

into bitmap contexts, 291–293

touch-based painting, 321–323

duplex connections with BonjourHelper class, 530

dynamic typing, explained, 96–98

E

e-mailing images, 272–273

editing

Address Book contacts, 748–750

application identifiers, 66–67

distribution configurations, 78–79

main.m (hybrid temperature converter example), 172–173

model files (Core Data), 758

navigation bar, 159

simulator library, 48

tables in Core Data, 773–775

video, 639–641

view controller implementation, 171–172

views, 44–45

editor windows (Xcode projects), 42

efficiency of custom slider thumbs, 358

embedding images onto scrollers, 278–280

enabling

accessibility, 802

interactions, 160

proximity sensor, 596–597

reorientation, 175–176

simulated elements, 160

zombies, 57

energy limits, platform differences, 11

Enterprise Developer Program, 2

entities (Core Data), 758

header files, generating, 759–760

inserting into contexts, 761–763

entitlement files, 83

epochs, 131

error handling for device token requests, 664–665

errors, treating warnings as, 98

evaluating autosize option, 178–179

events

control events, 341–344

motion events, detecting shakes, 603–604

sending from controls, 364

executable, 23

extending

classes, 120–121

UIDevice class for reachability, 547–549

extracting

numbers from strings, 130

view hierarchy tree, 213

F

fading views, 237–238

fast enumeration of collections, 101

feedback service for push notifications, 685–686

fetch requests (Core Data), 763–764

fetch results (Core Data)

search tables example, 770–772

table data sources example, 767–770

file extensions, 19

file management, 136–138

file system size, checking, 608–609

File Transfer Protocol (FTP), accessing sites, 586–587

files

executable, 23

file types, 19

Info.plist, 23–25

IPA archives, 27

NIB files, 26

writing collections to, 135–136

writing/reading strings, 127–128

filtering

iPod library contents, 645–649

text entries, 374–376

finding

Address Book contacts, 735

best location match, 704–707

fixpng utility, 10–11

flipping views, 240–241

FlipView interface, 241

font table example, 428–430

FontLabel, 388

footers for tables, customizing, 474–476

form data uploads, 572–575

format specifiers for strings, 104

formatting date/time, 490–493

Foundation, explained, 117

Foundation classes, 125–126

collections, 133–136

dates, 131–132

file management, 136–138

index paths, 132

NSData, 136

numbers, 131

strings, 126–130

timers, 132

URLs, building, 136

frames. See views

free space, checking, 608–609

freeform group tables, 473, 477–480

FTP (File Transfer Protocol), accessing sites, 586–587

FTPHelper class, 586–587

G

GameKit, 495

Bluetooth and, 495–497

clients, 498

complex data, sending, 510–512

limitations, overcoming, 523–527

online connections, creating, 537–540

peers, 498

connection process, 498–500, 502

state changes, 503

sending/receiving data, 502

servers, 498

sessions, 496, 498

status logs, monitoring, 509–510

Voice Chat, 512–515

GameKitHelper class, creating, 503, 505–509

connections/disconnections, 503–504

data handling, 504–505

gaming with BonjourHelper class, 528–537

Garbage Collection, 12

geocoding, 717–720

reverse geocoding, 700–702

geometry

interface design, 151

keyboards, 154–155

navigation bars/toolbars/tab bars, 153–154

status bar, 151–152

text fields, 155

UIScreen class, 155

view geometry, 222–223

coordinate systems, 224

frames, 223–224

transforms, 224

gesture distinction, 329–333

getters

creating custom, 107–109

explained, 106–107

GKPeerPickerController class, 151, 498

GKSession class, 500

GKVoiceChatService class, 512

GPS positioning, 690

Graphics Convert application, 11

grayscale images, 298–299

grouped tables, creating, 473, 477–480

groups (Address Book), 736–738

guides, adding, 184

H

.h file extension, 19

handler methods, adding, 816–817

hardware requirements, 3

header files, 92

Core Data, generating, 759–760

importing, 93

viewing side-by-side with method file, 88

header titles for table sections, creating, 470–471

headers for tables, customizing, 474–476

Hewitt, Joe, 281

hiding status bar, 152

hierarchies, view, 211–213

hints, accessibility, 801

Hockenberry, Craig, 814

host information, retrieving, 552–555

hybrid positioning approaches, 691

hybrid temperature converter example, 170

adapting template, 170

adding view controller, 170

designing interface, 171

editing main.m, 172–173

editing view controller implementation, 171–172

running application, 173

I

IB (Interface Builder). See Interface Builder

icon.png files, 25–26

id type, 99

identities (Xcode), customizing, 85–86

ignoring lock events, 622–624

iLime service, 793

image backdrops, creating, 160

Image Picker, 150, 263

image processing

applying, 293–295

limitations, 295–297

image view animations, 250–251

ImageHelper class, 260–261

images

adding random contact art, 752–754

Address Book images, 733–734

accessing image data, 741–742

background images for tables, creating, 432–433

bitmaps, 291

applying image processing, 293–295

drawing into bitmap contexts, 291–293

image-processing limitations, 295–297

creating from scratch, 281–285

custom camera overlays, 275, 277–278

e-mailing, 272–273

grayscale, 298–299

loading

from application bundle, 258

with ImageHelper class, 260–261

from photo album, 260, 262–265

from sandbox, 258–259

from URLs, 259–260

photo orientation, 288–290

saving to Documents folder, 270–271

screenshots, 290–291

scroll views

creating multiimage paged scroll, 280–281

displaying images in scrollable view, 278–280

selecting and customizing from camera roll, 265–268

snapping photos with iPhone and writing to photo album, 268–270

sources, 257–258

thumbnails, creating, 285–288

time-lapse photos, capturing, 273–275

uploading to TwitPic, 572–575

importing header files, 93

in-app purchase items (StoreKit), creating, 782–786

adding item details, 784–785

application approval, 785–786

pricing section, 783–784

submitting purchase GUI screenshot, 785

inactive device tokens, managing, 685–686

index path access (Core Data), 767

index paths, 132, 425

index titles (Core Data), 768

indexed characters of strings, 126

indexed substrings, requesting, 128

indexes for table sections, creating, 471–472

Info Dark button, 344

Info Light button, 344

Info.plist files, 23–25

list of keys, 821–824

inheriting methods, 98

initializing audio players, 611–612

inserting entities into contexts (Core Data), 761–763

inspecting

class headers, 163

objects in debugger, 55

installing development provisions, 66

instance methods. See methods

instance variables, 91

instances, 94

instant message properties (Address Book), 730–733

Instruments application

definition of, 4

detecting leaks, 59–60, 62

monitoring caching, 62–64

interaction limits, platform differences, 11

interactions, enabling, 160

interactive resize and rotation, 333–338

Interface Builder

adding buttons, 345–347

adding VoiceOver accessibility from, 799–802

converting to Objective-C, 51–53

custom table cells, building, 435–439

definition of, 4

tab bar controllers in, 207–208

table cells with built-in controls, 441–443

temperature converter example, 156–159

adding connections, 163–164

adding labels, 160

adding media to, 157

adding outlets/actions, 162

capturing colors, 165

creating image backdrops, 160

creating new project, 156

defining conversion method, 165–166

editing navigation bar, 159

enabling simulated elements, 160

inspecting class header, 163

replacing main view, 159–160

running application, 166

testing interface, 161

tips for, 184–185

toolbars, creating, 384–385

views, editing, 44–45

.xib files, opening, 43–44

interface creation, 155–156

code-based example, 166–169

hybrid example, 170

adapting template, 170

adding view controller, 170

designing interface, 171

editing main.m, 172–173

editing view controller implementation, 171–172

running application, 173

Interface Builder example, 156–159

adding connections, 163–164

adding labels, 160

adding media to, 157

adding outlets/actions, 162

capturing colors, 165

creating image backdrops, 160

creating new project, 156

defining conversion method, 165–166

editing navigation bar, 159

enabling simulated elements, 160

inspecting class header, 163

replacing main view, 159–160

running application, 166

testing interface, 161

loading .xib files from code example, 173–174

interface design, 143

bars, 146–147

controls, 145–146

geometry, 151–155

hybrid temperature converter example, 171

Interface Builder tips, 184–185

pickers, 146

progress indicators, 147

for rotation, 174–175

autosizing, 176–179

enabling reorientation, 175–176

moving views, 179–180, 182

swapping views, 183

tables, 146

UIView class, 143–144

UIWindow class, 143–144

view controllers, 147–148

address book controllers, 150

GKPeerPickerController class, 151

media player controllers, 151

MFMailComposeViewController class, 150

table controllers, 149–150

UIImagePickerController class, 150

UINavigationController class, 148–149

UITabBarController class, 149

UIViewController class, 148

views

displaying data, 144

making choices, 145

interfaces

declaring, 92

FlipView, 241

Internet, downloading images from, 257

Internet provider positioning, 691

interruptions to audio, handling, 621–622

IP information, retrieving, 552–555

IPA archives, 27

iPhone deployment. See deployment

iPhone developer programs

Enterprise Developer Program, 2

Online Developer Program, 2

registering for, 3

Standard Developer Program, 2

table of, 1–2

University Developer Program, 3

iPhone Development Tools list (Organizer), 71

iPhone model differences

OpenGL ES, 9

cameras, 7

core location differences, 8

microphones, 7–8

overview, 7

processor speeds, 9

speakers, 7–8

telephony, 8

vibration support and proximity, 9

iPhone platform limitations

application limits, 11

behavior limits, 12

data access limits, 10

energy limits, 11

interaction limits, 11

memory limits, 10

overview, 9

storage limits, 10

iPhone SDK Simulator. See Simulator

iPhone SDK. See SDK (Software Developer’s Kit)

iPhone servers

creating with Bonjour, 515–520

Mac clients, creating, 520–523

iPhone-specific definitions, recovering, 74–75

iPod library contents, filtering, 645–649

item details for in-app purchase items (StoreKit), 784–785

iTunes Connect, registering for, 3

J—K

JSON (JavaScript Object Notation), 672

converting aps dictionary to, 674–675

payload samples, 674

key-value pairs, custom data in notification payloads, 675

keyboards

dismissing, 366–371

geometry of, 154–155

keychain

persistence of data, 567

sharing between applications, 575–577

storing user credentials, 566–569

KeychainItemWrapper class, 567

keys, dictionary keys, listing, 135

Kosmaczewski, Adrian, 51

Krasner, Glenn, 29

L

labels

accessibility, 800–801

adding, 160

smart labels, 387–388

landscape views, centering, 234–235

languages for item details (StoreKit), 784–785

latitude and longitude, tracking, 691

code listing, 693

location properties, 694–695

step-by-step process, 692

launching applications, receiving notification data, 675–676

laying out table views, 424

layout guides, adding, 184

leaks, memory management, 58–62

length of strings, 126

Library folder, 259

limitations

of iPhone SDK, 12–13

platform limitations, 9–12

Simulator limitations, 5–6

limiting contact picker properties (Address Book), 745–747

lines, calculating, 323–325

listing dictionary keys, 135

Llama Settings project, 813

loading

images

from application bundle, 258

with ImageHelper class, 260–261

from photo album, 260, 262–265

from sandbox, 258–259

from URLs, 259–260

view controller arrays, 198

.xib files from code, 173–174

localization for item details (StoreKit), 784–785

localized alerts, 673

location properties (CLLocation object), 694–695

locations

geocoding, 717–720

map annotations, 710–716

user location annotations, 707–708

viewing, 703–707

lock events, ignoring, 622–624

log files, monitoring, 509–510

logging class information, 103–105

looping audio, 618–620

loops, run loops, creating modal alerts with, 396–399

M

.m file extension, 19

Mac clients for iPhone Bonjour servers, creating, 520–523

mail composition, 150

main view, replacing, 159–160

main.m file

autorelease pools, 19–20

hybrid temperature converter example, editing, 172–173

purpose of, 19

UIApplicationMain function, 20

managed contexts. See contexts (Core Data)

map annotations

adding, 710

annotation views, 710–712

creating, 710

geocoding, 717–720

MapAnnotation class, 709–710

responding to annotation button taps, 712–716

MapAnnotation class, 709–710

MapKit. See also map annotations

reverse geocoding, 700–702

user location annotations, 707–708

viewing locations, 703–707

masking reflections with Core Graphics, 253–255

measurements in interface design, 151

keyboards, 154–155

navigation bars/toolbars/tab bars, 153–154

status bar, 151–152

text fields, 155

UIScreen class, 155

media. See also audio; video

adding to projects, 157

adding to views, 184

media player controllers, 151

Media Queries

creating, 645–649

types of, 645

memory limits, platform differences, 10

memory management, 58

allocating memory, 94

autorelease, 58

autorelease object lifetime, 112

caching, 59

monitoring with Instruments application, 62–64

Clang static analyzer, 64–65

collections, 135

Core Foundation, 116–117

creating autorelease objects, 111–112

creating objects, 110–111, 115–116

deallocating objects, 117–119

explained, 110

high retain counts, 115

leaks, 58–62

releasing memory, 94–95

properties and, 105–106

retained properties, 113–114

retaining autorelease objects, 112–113

menus

creating, 403–405

scrolling, 405

two-item menu example (navigation controllers), 192–193

message forwarding

compiler warnings, 140

explained, 138

implementing, 139

method signatures, building, 139

multiple inheritance, 140–141

undocumented methods of, 141

message tracking, 35

messages, sending to nil, 100. See also alerts

method files, viewing side-by-side with header file, 88

method signatures, building, 139

methods, 91

accessor methods, 105

class methods, 101

collapsing, 77

data source methods for tables, 427–428

declaring, 98–99

delegate methods

in alerts, 392–394

for table searches, 467

for table sections, 472

dynamic typing, 96–98

explained, 93, 95–96

frame utility methods, 227–231

for group tables, 478

implementing, 99

inheriting, 98

nesting invocations, 100

for picker views, 482

searchable data source methods, building, 465–466

variadic arguments with alerts, 402–403

MFMailComposeViewController class, 150

MFMailComposeViewControllerDelegate protocol, 272

microphones, model differences, 7–8

MKAnnotation class, 709

MKAnnotationView class, 711

MKMapView class, 144

MKPlaceMark class, 701

MKReverseGeocoder class, 701

MKReverseGeocoderDelegate class, 701

MKUserLocation class, 707

mobile provisions

building, 83

definition of, 23

modal alerts, creating with run loops, 396–399

modal controllers, 190

custom example, 199–201

model differences

OpenGL ES, 9

cameras, 7

core location differences, 8

microphones, 7–8

overview, 7

processor speeds, 9

speakers, 7–8

telephony, 8

vibration support and proximity, 9

model files (Core Data), creating/editing, 758

model-view-controller design pattern. See MVC (model-view-controller) design pattern

models (MVC)

data sources, 34–35

message tracking, 35

overview, 34

UIApplication class, 35

modifying Address Book contacts, 748–750

momentary views, pushing, 198–199

monitoring

audio levels, 613

battery state, 594–595

caching with Instruments application, 62–64

status logs, 509–510

motion events, detecting shakes, 603–604

movement, constraining, 305, 307

movies. See video

moving

bounded views, 231–232

objects, 185

onscreen objects with accelerometer, 599–601

views, 179–180, 182

MPMediaItem class, 642–644

MPMediaPickerController class, 151, 641, 647

MPMoviePlayer class, 634–636

MPMoviePlayerController class, 151, 634, 653

MPMusicPlayerController class, 151, 649–653

multiimage paged scroll, creating, 280–281

multiline button text, 351

multimedia. See audio; video

multiple buttons in segmented controls, 362–363

multiple inheritance, message forwarding, 140–141

multiple item purchases (StoreKit), 794

multiple provider support for push notifications, 657

multitouch, 303–304

detecting, 327–329

multivalue record properties (Address Book), 727–730

multiwheel tables, building, 480–484

music. See audio

mutable arrays, 97, 133

mutable buffers, 136

mutable dictionaries, 134

mutable strings, 130

MVC (model-view-controller) design pattern

controller behavior

delegation, 30–31

notifications, 33

overview, 30

target-actions, 32

message tracking, 35

models, 34–35

overview, 28–29

view classes, 29–30

N

names (Bonjour), registering, 528–529

naming

classes in Cocoa Touch, 92

views, 184, 219–222

navigating between view controllers example (navigation controllers), 195–197

navigation applications, 37

navigation bars, 146–147

editing, 159

geometry of, 153–154

undo support, 316–317

navigation controllers, 148–149, 187

custom modal controllers example, 199–201

custom popping options example, 197–199

modal controllers, 190

navigating between view controllers example, 195–197

persistence example, 204–207

pushing/popping, 188–189

segmented control example, 193–195

setup, 187–188

tab bars

example, 201–204

in Interface Builder, 207–208

two-item menu example, 192–193

UINavigationItem class, 189–190

nesting method invocations, 100

network activity indicators, 415–416

network connections. See connections

network status, checking, 545–547

NeXTStep operating system, 91

NIB files, 26

nil, 100

no-button alerts, 394–396

non-consumable purchases, 783

north, detecting direction of, 698–700

notification payloads

building, 672

converting aps dictionary to JSON, 674–675

custom key-value pairs, 675

localized alerts, 673

notification types, 673

receiving data on launch, 675–676

sending, 676–681

notifications. See push notifications

NSArray class, 97, 133–134

NSBundle class, 137

NSData class, 136

NSDate class, 131–132

NSDateFormatter class, 132, 490

NSDictionary class, 134–135

NSFetchedResultsController class, 150, 764

NSFileManager class, 136–138, 608

NSHomeDirectory() function, 259

NSIndexPath class, 132

NSKeyedArchiver class, 314

NSKeyedUnarchiver class, 314

NSLog function, 103–105

NSMutableArray class, 97, 133

NSMutableData class, 136

NSMutableDictionary class, 134

NSMutableString class, 130

NSNetServiceBrowser class, 520, 540

NSNotificationCenter class, 33, 426

NSNumber class, 131

NSObject class, 94, 102

NSOperation class, 570

NSOperationQueue class, 570

NSSet class, 135

NSString class, 92, 103, 126–130

accessing substrings, 128–129

building strings, 126

changing case, 129

converting to/from C strings, 127

extracting numbers from strings, 130

indexed characters, 126

length of strings, 126

mutable strings, 130

search/replace with, 129

testing strings, 130

writing to/reading from files, 127–128

NSStringFromCGRect() function, 223, 313

NSTimeInterval class, 131

NSTimer class, 132

NSUndoManager class, 457

NSURL class, 136

NSURLConnection class, 557

NSURLCredential class, 565

NSURLRequest class, 569

NSUserDefaults class, 806

NSXMLParser class, 577

numbers

extracting from strings, 130

NSNumber class, 131

O

object layout, viewing, 185

object-oriented programming, 28, 91–92

Objective-C

categories, 120–121

classes

explained, 92–93

hierarchy, 102–103

logging information, 103–105

collections, 101

converting Interface Builder files to, 51–53

dynamic typing, 96–98

explained, 91–92

Foundation classes, 125–126

collections, 133–136

dates, 131–132

file management, 136–138

index paths, 132

NSData, 136

numbers, 131

strings, 126–130

timers, 132

URLs, building, 136

header files, 92

memory management, 94–95

autorelease object lifetime, 112

Core Foundation, 116–117

creating autorelease objects, 111–112

creating objects, 110–111, 115–116

deallocating objects, 117–119

explained, 110

high retain counts, 115

retained properties, 113–114

retaining autorelease objects, 112–113

message forwarding, 138–141

methods, 93–101

objects, 92–94

properties, 105–110

protocols, 122–125

singletons, 119–120

objects. See also specific objects

autorelease objects, 111–113

creating, 93–94, 110–111, 115–116

deallocating, 117–119

explained, 92–93

inspecting in debugger, 55

moving, 185

retain counts, 95

online connections, creating with GameKit, 537–540

Online Developer Program, 2

onscreen objects, moving with accelerometer, 599–601

OpenAL audio, 629

OpenGL ES, 9, 37

opening

debugger, 53

.xib files, 43–44

operation queues, 570

operations, 570

optional callbacks, 123–124

Organizer, 69

Console tab, 72

Crash Log tab, 72–73

Devices list, 71

iPhone Development Tools list, 71

Projects and Sources list, 70

Screenshot tab, 73

Summary tab, 71–72

orientable scroll-down alerts, 412–415

orientation

designing for rotation, 174–175

autosizing, 176–179

enabling reorientation, 175–176

moving views, 179–182

swapping views, 183

device orientation, detecting, 601–603

of photos

fixing, 288–290

test images, adding, 290

of status bar, 152

outlets, 162

overcoming GameKit limitations, 523–527

overlays

custom overlays

creating for progress indicators, 409–411

custom camera overlays, 275–278

orientable scroll-down alerts, 412–415

tappable overlays, 411–412

P

page indicators

adding, 376–378

customized paged scroller example, 379–383

parse trees

browsing, 580–582

building, 578

passwords, storing in keychain, 566–569

pasteboards, 524–525

pathToView() function, 214

payloads. See notification payloads

payments (StoreKit), responding to, 791–792

peer pickers, 151

peer-to-peer connections. See Bonjour; GameKit

peers in GameKit, 498

connection process, 498–502

state changes, 503

people picker (Address Book), 742–745

performance of Media Queries, 647–649

persistence, 311

of keychain data, 567

navigation controllers example, 204–207

persistence through archiving, 314–315

recovering state, 313–314

storing state, 312–313

in text editors, 371

phases of touches, 302

phone calls, 621–622

photo album, 257. See also images

loading images from, 260–265

writing photos to, 268–270

picker views

building multiwheel tables, 480–484

cylinder roll example, 484–487

date/time, entering, 487–490

pickers, 146

picking

audio, 641–645

GameKit peers, 498–502

people (Address Book), 742–745

video, 639–640

platform limitations

application limits, 11

behavior limits, 12

data access limits, 10

energy limits, 11

interaction limits, 11

memory limits, 10

overview, 9

storage limits, 10

playing

audio, 611–618

catching end of playback, 614

ignoring lock events, 622–624

initializing audio players, 611–612

looping audio, 618–620

monitoring audio levels, 613

resuming after interruption, 621–622

scrubbing audio, 614

with MPMusicPlayerController class, 649–653

video with MPMoviePlayer, 634–636

plus (+) class methods, 101

pngcrush utility, 10

pop-ups, 403

Pope, Stephen, 29

popping navigation controllers, 188–189, 197–199

populating tables, 427

ports (Bonjour), registering, 528–529

positioning

cell tower positioning, 690

GPS positioning, 690

hybrid approaches, 691

Internet provider positioning, 691

SkyHook Wi-Fi positioning, 690

POST requests, uploading via, 569–572

pragma marks, 76–77

predicates

in fetch requests (Core Data), 770–772

in Media Queries, 646–647

in table searches, 466

preferences tables, 473, 477–480

pricing section for in-app purchase items (StoreKit), 783–784

processor speeds, 9

production environments for push notifications, 677

progress indicators, 147

classes for, 406–407

creating, 407–409

custom overlays, 409–411

projects

adding media to, 157

compiling, 68

creating, 37–39

Detail pane, 41–42

editing views, 44–45

editor windows, 42

from scratch, 48–52

opening .xib files, 43–44

project files, list of, 43

running in simulator, 46

styles of, 37–38

Xcode project window, 40–41

signing compiled, 68–69

Projects and Sources list (Organizer), 70

properties. See also specific properties

AddressBook properties

address and instant message properties, 730–733

date properties, 726–730

multivalue record properties, 727–730

attributes, 109–110

of CLLocation object, 694–695

creating, 106–107

custom getters/setters, 107–109

dot notation, 105

explained, 105

memory management, 105–106

of MPMediaItem class, 643–644

of MPMoviePlayerController class, 653

retained properties

assigning values to, 113–114

cautions about, 114

deallocating objects, 118

reassigning, 114

self-assigning, 112

of text fields, 367–368

of UIDatePicker class, 487

of UIView class, 235–236

property lists, serializing/deserializing, 510–512

protocols

adding callbacks, 123

conforming to, 124–125

declaring optional callbacks, 123–124

defining, 122–123

explained, 122

implementing optional callbacks, 124

incorporating, 123

provisioning, 16

mobile provisions, 83

push-specific provisions, 661–662

proxies, 43

proximity sensor, enabling/disabling, 596–597

purchase GUI (StoreKit)

creating, 787–789

screenshot for in-app purchase items, submitting, 785

purchase models (StoreKit)

application submission, 787

explained, 779–781

in-app purchase items, creating, 782–786

purchase GUI, creating, 787–789

purchasing items, 789–794

test accounts, creating, 781–782

validating receipts, 794–796

purchase types (StoreKit), 783

purchasing items (StoreKit), 789–794

multiple items, 794

registering purchases, 792–794

responding to payments, 791–792

restoring purchases, 793–794

signing into test accounts, 790

push notifications, 33

advantages of, 655–656

application registration, 662–663

error handling, 664–665

responding to notifications, 665–666

retrieving device tokens, 663–664

building notification payloads, 672

converting aps dictionary to JSON, 674–675

custom key-value pairs, 675

localized alerts, 673

notification types, 673

receiving data on launch, 675–676

client skeleton example, 667–672

designing for, 686–687

development process

application identifier, generating, 659

push-specific provisions, 661–662

SSL certificate, generating, 660–661

explained, 656

feedback service, 685–686

limitations of, 658–659

multiple provider support, 657

security, 658

sending notification payloads, 676–681

table notifications, 426

Twitter client example, 681–685

push-specific provisions, 661–662

pushing

navigation controllers, 188–189

temporary views, 198–199

Q—R

querying subviews, 214–215

queues, 417, 629–634

random contact art, adding, 752–754

ranges, generating substrings from, 129

reachability, extending UIDevice class for, 547–549. See also availability

read-only properties, 106–107

read-write properties, 106

reading

with BonjourHelper class, 530

image data, 258

loading image files with ImageHelper class, 260–261

loading images from application bundle, 258

loading images from photo album, 260–265

loading images from sandbox, 258–259

loading images from URLs, 259–260

strings from files, 127–128

reassigning retained properties, 114

receipts (StoreKit), validating, 794–796

receivers, 99

receiving

GameKit data, 502

notification data on launch, 675–676

recording

audio, 624–634

video, 636–639

records (Address Book)

adding, 734

creating, 734

deleting, 735–736

multivalue record properties, 727–730

retrieving and setting ABRecord strings, 725–726

recovering

iPhone-specific definitions, 74–75

state, 313–314

view hierarchy tree, 213

redo/undo support

in Core Data, 775–778

Redo buttons, adding to tables, 458–460

referencing system address book, 724

reflections

adding to views, 251–252

masking with Core Graphics, 253–255

registration

application identifiers, 15

Bonjour names and ports, 528–529

devices, 14–15, 83

for developer programs, 3

for iTunes Connect, 3

purchases (StoreKit), 792–794

for push notifications, 662–666

registering schemes

adding handler method, 816–817

declaring URL, 815–816

undos, 317–318

relationships (Core Data), 758, 766

releasing memory, 94–95

reliable mode, sending/receiving data, 502

remote notifications. See push notifications

remove controls, 452

removing

Address Book records, 735–736

breakpoints, 55

dictionary objects, 135

objects (Core Data), 765–767

selection highlights in table cells, 448–449

simulator data, 48

subviews, 216

table cells, 451–456

tree data structures, 582

reordering

subviews, 216

table cells, 456–457

reorientation, enabling, 175–176

replacing

dictionary objects, 134

main view, 159–160

search/replace, 129

requesting

certificates, 14

indexed substrings, 128

requirements, device capability requirements, 590–592

resizing

frames, 225–226

text editors, 372

responder chain, 603–604

responding

to annotation button taps, 712–716

to payments (StoreKit), 791–792

to push notifications, 665–666

to URL scheme requests, 818–819

restoring purchases (StoreKit), 793–794

resuming audio playback after interruption, 621–622

retain counts, 95, 115

retaining

autorelease objects, 112–113

properties, 109, 113–114, 118

retrieving

ABRecord strings, 725–726

data via pasteboards, 525

device tokens, 663–664

IP and host information, 552–555

objects (Core Data), 763–764

views, 217–218

returning

control to calling application, 817–818

table cells from sections, 470

reusing table cells, 425, 428, 445–446

reverse geocoding, 700–702

review, submitting applications for, 787

root view controllers, 156

rotation

designing for, 174–175

autosizing, 176–179

enabling reorientation, 175–176

moving views, 179–182

swapping views, 183

interactive resize and rotation, 333–338

Rounded Rectangle button, 344

rows in tables, counting, 469–470

run loops, 396–399

running

console, 55–56

debugger, 53

projects in simulator, 46

runtime checks, 75–76

S

sandbox

loading images from, 258–259

overview, 27, 257

sandbox environments for push notifications, 677

sandbox files, 47

saving images to Documents folder, 270–271

.sb file extension, 28

scaling for push notifications, 686–687

scanning

for Bonjour services, 540–543

for connectivity changes, 549–552

screen

screen orientation for scroll-down alerts, 412–415

UIScreen class, 155

Screenshot tab (Organizer), 73

screenshots, 290–291, 785

scroll-down alerts, 412–415

scrolling

changing background color based on, 431–432

menus, 405

scroll views

creating multiimage paged scroll, 280–281

displaying images in scrollable view, 278–280

scrubbing audio, 614

SDK (Software Developer’s Kit), 3

Cocoa Touch, 4–5

development devices, 5

downloading, 3

hardware requirements, 3

IB (Interface Builder), 4

Instruments, 4

limitations of, 12–13

SDK APIs, accessing from Xcode, 50–51

Shark, 4

Simulator, 4–6

Xcode, 4

search display controllers, 149, 464–465

search tables, Core Data for, 770–772

searchable data source methods, 465–466

searching

Address Book, 738–740

Address Book contacts, 735

dictionaries, 134

search/replace, 129

tables

delegate methods, 467

search display controller, building, 464–465

searchable data source methods, building, 465–466

section groups (Core Data), 768

section key paths (Core Data), 767

sectioned tables, 467

building with Core Data, 769

counting, 469–470

data structure, creating, 468–469

delegate methods with, 472

header titles, creating, 470–471

indexes, creating, 471–472

returning cells from, 470

security

for push notifications, 658, 686–687

Security framework, 567

user credentials, storing in keychain, 566–569

segmented controls, 193–195, 362–363

selected table cells, customizing, 439

selecting

images from camera roll, 265–268

from stacked views, 184

selection color for table cells, 429

selection highlights in table cells, removing, 448–449

selectors, 93

self variable, 99

self-assigning properties, 112

sending

complex data via GameKit, 510–512

events from controls, 364

GameKit data, 502

messages to nil, 100

notification payloads, 676–681

serializing property lists, 510–512

server mode (peer pickers), 500, 502

servers

in GameKit, 498

iPhone servers

creating with Bonjour, 515–520

Mac clients, creating, 520–523

Web servers, 582–586

services, URL-based

adding handler method, 816–817

cross-promotion, 815

declaring URL, 815–816

implementing custom schemes, 818

overview, 814

responding to URL scheme requests, 818–819

returning control to calling application, 817–818

service downsides, 815

URL schemes, 814–815

session objects, creating, 500

sessions in GameKit, 496–498

sets, 133–135

setters

creating custom, 107–109

explained, 106–107

setting ABRecord strings, 725–726

Settings app, 807

settings schema, 808

shake-controlled undo support, 319–320, 458

shakes, detecting

with accelerometer, 605–608

with motion events, 603–604

sharing keychains between applications, 575–577

sharing data via pasteboards, 524

Shark, 4

showAlert( ) function, 190–191

side-by-side code, viewing, 88

signatures, method signatures, 139

signing

compiled applications, 68–69

into test accounts (StoreKit), 790

simple direct manipulation interface, 304–305

simulated elements, enabling, 160

Simulator

clipboard for, 48

definition of, 4

explained, 46–48

limitations, 5–6

running projects in, 46

singletons, 101, 119–120

site availability, checking, 555–557

sizing

frames, 225–226

interactive resize and rotation, 333–338

SkyHook Wi-Fi positioning, 690

sleep mode, ignoring, 622–624

sliders, custom slider thumbs, 356–361

Smalltalk, 28, 91

smart labels, 387–388

Software Developer’s Kit. See SDK

sorting tables, 462–463

sound. See audio

source files

application delegate, 20–21

main.m, 19–20

overview, 18–19

view controller, 21–22

speakers, 7–8

speed

computing, 696–697

for Media Queries, 647–649

tracking, 695–696

springs, 176

sqlite3 utility, 762

SSL certificates, generating for push notifications, 660–661

stacked views, selecting from, 184

Standard Developer Program, 2

state

recovering, 313–314

state changes in GameKit peers, 503

storing, 312–313

of table cells, retaining, 443–445

static analyzer, 64–65

static typing, 96

status bar, 151–152

status logs, monitoring, 509–510

storage limits, 10

StoreKit

application submission, 787

explained, 779–781

in-app purchase items

adding item details, 784–785

application approval, 785–786

creating, 782–786

pricing section, 783–784

submitting purchase GUI screenshot, 785

purchase GUI, 787–789

purchasing items, 789–794

test accounts, 781–782

validating receipts, 794–796

storing

data via pasteboards, 524

state, 312–313

user credentials in keychain, 566–569

stretching views, 349

strings. See also NSString class

ABRecord strings, 725–726

converting arrays to, 134

format specifiers, 104

struts, 176

subclassing UIControl class, 363–366

submitting

applications for review, 787

purchase GUI screenshot (StoreKit), 785

subscription purchases, 784

substrings, accessing, 128–129

subviews

adding, 216

querying, 214–215

removing, 216

reordering, 216

view callbacks, 216–217

Summary tab (Organizer), 71–72

swapping views, 183, 239–240

swipes, 329, 453

switches, 354–356

symbolication, 73

synchronize method, 807

synchronous downloads, 557–560

sysctl() method, 592–593

sysctlbyname() method, 592–593

System Audio services, 417–418

System Configuration framework, 546

system information, 589–590, 592–593

system sounds

creating, 417–420

delays, 419

T

tab bars, 149

geometry of, 153–154

in Interface Builder, 207–208

navigation controllers example, 201–204

persistence example, 204–207

Tab bar applications, 37

table controllers, 149–150

table notifications, 426

tables, 146

background color, 430–432

background image, 432–433

cells. See cells (table)

creating, 424

data sources, 427–428, 767–770

date/time, entering, 487–490

editing in Core Data, 773–775

font table example, 428–430

group tables, 477–480

grouped tables, 473

headers/footers, 474–476

multiwheel tables, 480–484

populating, 427

searching

delegate methods, 467

search display controller, building, 464–465

searchable data source methods, building, 465–466

sections, 467

counting, 469–470

data structure, creating, 468–469

delegate methods with, 472

header titles, creating, 470–471

indexes, creating, 471–472

returning cells from, 470

sorting, 462–463

UITableView class, 423–426

UITableViewController class, 424

undo support, 457–462

adding Undo/Redo buttons, 458–460

in Core Data, 775–778

shake-to-edit, 458

tagging views, 173–174, 217–218

tappable overlays, 411–412

taps, 329

target-actions, 32

target settings, 83

TCPConnection class, 515

TCPServer class, 515

teams, 13–14

tearing down tree data structures, 582

telephony, 8

temperature converter example

code-based, 166–169

hybrid

adapting template, 170

adding view controller, 170

designing interface, 171

editing main.m, 172–173

editing view controller implementation, 171–172

running application, 173

Interface Builder, 156–159

adding connections, 163–164

adding labels, 160

adding media to, 157

adding outlets/actions, 162

capturing colors, 165

creating image backdrops, 160

creating new project, 156

defining conversion method, 165–166

editing navigation bar, 159

enabling simulated elements, 160

inspecting class header, 163

replacing main view, 159–160

running application, 166

testing interface, 161

loading .xib files, 173–174

templates

adapting, 170

creating custom, 86–88

creating projects, 37–39

Detail pane, 41–42

editing views, 44–45

editor windows, 42

opening .xib files, 43–44

project files, list of, 43

running in simulator, 46

Xcode project window, 40–41

moving views, 180–182

temporary views, pushing, 198–199

testing

accessibility, 803–806

arrays, 134

interface, 161

network status, 545–547

strings, 130

test accounts (StoreKit)

creating, 781–782

signing into, 790

test images, adding, 290

touches, 307–308

circular hit test, 308

testing against bitmap alpha levels, 309–311

tethering, 6–7

text

displaying in action sheets, 405–406

multiline button text, 351

text fields

geometry of, 155

keyboards, dismissing, 366–369

properties, 367–368

text entry filtering, 374–376

text input, requesting via alerts, 399–402

text editors, 371–374

text views

keyboards, dismissing, 370–371

smart labels, 387–388

text editors, creating, 371–374

thumbnails, creating from images, 285–288

thumbs (sliders), 356

time-lapse photos, capturing, 273–275

time/date

entering in tables, 487–490

formatting, 490–493

timers, NSTimer class, 132

timestamp property (CLLocation object), 695

To Do List view hierarchy, 212–213

toggle buttons, 354–356

Toll Free Bridging, 117

toolbars, 146–147

creating

in Interface Builder, 384–385

tips for, 387

in Xcode, 385–386

customizing, 56–57

geometry of, 153–154

touch wheels, 363–366

touch-based painting, 321–323

touches

calculating lines, 323–325

constraining movement, 305–307

detecting circles, 325–327

gesture distinction, 329–333

interactive resize and rotation, 333–338

methods, 302–303

multitouch, 303–304, 327–329

overview, 301–302

persistence, 311–315

phases, 302

simple direct manipulation interface, 304–305

testing, 307–311

touch-based painting, 321–323

touching views, 303

tracking, 364

undo support

child-view undo support, 316

creating undo managers, 316

custom undo routine, 318–319

navigation bars, 316–317

registering undos, 317–318

shake-controlled undo support, 319–320

tracking

latitude and longitude

code listing, 693

location properties, 694–695

step-by-step process, 691–692

speed, 695–696

touches, 364

transaction observers, 789

transforming views, 224, 232

affine transform of UIView, 233–234

centering landscape views, 234–235

transitions (view)

Core Animation calls, 244–246

Core Animation transitions, 242–244

curl transitions, 246–247

transparency, animating transparency changes in views, 237–238

tree data structures, converting XML data to, 577–582

troubleshooting

device orientation sensing, 602

enabling interactions, 160

TwitPic, uploading images to, 572–575

Twitter client example (push notifications), 681–685

Twitterrific, 814

two-item menu example (navigation controllers), 192–193

U

UDIDs (unique device identifiers), 14

UIAcceleration class

locating “up,” 597–599

moving onscreen objects, 599–601

UIAccelerometerDelegate protocol, 597

UIAccessibility protocol, 802

UIActionSheet class, 145, 391, 394, 403–405

UIActivityIndicatorView class, 147, 406–407

UIAlertView class, 145, 391–394

UIApplication class, 35, 119

UIApplicationMain function, 20

UIBarButtonItem class, 145, 347

UIButton class, 145, 344–345, 351

UIControl class. See also controls

control events, 341–344

subclassing, 363–366

types of controls, 341

UIDatePicker class, 146, 487–490

UIDevice class, 119–121, 589–590

battery state, monitoring, 594–595

device orientation, detecting, 601–603

enabling/disabling proximity sensor, 596–597

extending for reachability, 547–549

retrieving IP and host information, 552–555

UIEdgeInsetsInsetRect() function, 231

UIImage class. See images

UIImageJPEGRepresentation() function, 270

UIImageOrientation class, 288–290

UIImagePickerController class, 148–150, 262–267, 638

UIImagePNGRepresentation() function, 270

UIImageView class, 144

UIImageWriteToSavedPhotosAlbum() function, 268

UILabel class, 144, 387

UINavigationBar class, 146

UINavigationController class, 30, 148–149, 187. See also navigation controllers

UINavigationItem class, 189–190

UIPageControl class, 146, 376–378

UIPasteboard class, 524

UIPickerView class, 146, 480–482

UIProgressView class, 147, 406–409

UIResponder class, 102

UIScreen class, 155

UIScrollView class, 144

UISearchBar class, 147, 464

UISearchDisplayController class, 464

UISegmentedControl class, 146, 193–195, 362

UISlider class, 146, 356–361

UISwitch class, 146, 354

UITabBar class, 147

UITabBarController class, 30, 149, 201

UITableView class, 30, 146, 423. See also tables

UITableViewCellStyleDefault class, 433

UITableViewCellStyleSubtitle class, 433

UITableViewCellStyleValue1 class, 434

UITableViewCellStyleValue2 class, 434

UITableViewController class, 149, 424

font table example, 428

populating tables, 427

views, laying out, 424

UITextField class, 146

keyboards, dismissing, 366–369

text entry filtering, 374–376

UITextInputTraits protocol, 367

UITextView class, 144

keyboards, dismissing, 370–371

smart labels, 387–388

text editors, creating, 371–374

UIToolbar class, 147

UITouchPhaseBegan class, 302

UITouchPhaseCancelled class, 302

UITouchPhaseEnded class, 302

UITouchPhaseMoved class, 302

UITouchPhaseStationary class, 302

UIVideoEditorController class, 640

UIView class, 29, 143–144. See also views

UIViewController class, 29–30, 148

UIWebView class, 144

UIWindow class, 143–144

undo support

child-view undo support, 316

in Core Data, 775–778

creating undo managers, 316

custom undo routine, 318–319

navigation bars, 316–317

registering undos, 317–318

shake-controlled undo support, 319–320

in tables, 457–462

adding Undo/Redo buttons, 458–460

shake-to-edit, 458

in text editors, 371

Undo buttons, adding to tables, 458–460

undo managers, creating, 316

unique device identifiers (UDIDs), 14

University Developer Program, 3

unreliable mode, sending/receiving data, 502

updating

application badges, 416–417

fetch requests (Core Data), 764

loadView method, 174

uploading

form data, 572–575

via POST requests, 569–572

uploads to App Store, debugging, 81–82

Urban Airship, 793

URL-based services, creating

adding handler method, 816–817

cross-promotion, 815

declaring URL, 815–816

implementing custom schemes, 818

overview, 814

responding to URL scheme requests, 818–819

returning control to calling application, 817–818

service downsides, 815

URL schemes, 814–815

URLs

building, 136

loading images from, 259–260

user credentials, storing in keychain, 566–569

user defaults, checking, 813–814

user interface design. See interface design

user location annotations, 707–708

utilities, 10–11, 38

V

validating

receipts (StoreKit), 794–796

text entries, 374–376

variables, deallocating objects, 118

variadic arguments, 402–403

vibration, 9, 418–420

video

editing, 639–641

picking, 639–640

playing, 634–636

recording, 636–639

view callbacks, 216–217

view classes, 29–30

view controllers, 21–22, 147–148. See also navigation controllers

adding, 170

address book controllers, 150

alerts, displaying, 190–191

arrays, loading, 198

custom modal controllers example, 199–201

editing implementation, 171–172

GKPeerPickerController class, 151

media player controllers, 151

MFMailComposeViewController class, 150

root view controller, 156

table controllers, 149–150

UIImagePickerController class, 150

UINavigationController class, 148–149

UITabBarController class, 149

UIViewController class, 148

view-based applications, 38

viewing

locations

finding best location match, 704–707

overview, 703–704

object layout, 185

side-by-side code, 88

views, 143–144

adding media to, 184

animations

bouncing views, 248–250

building UIView animation blocks, 236–237

callbacks, 237

Core Animation calls, 244–246

Core Animation transitions, 242–244

curl transitions, 246–247

fading views in and out, 237–238

flipping views, 240–241

image view animations, 250–251

overview, 236

swapping views, 239–240

annotation views, 710–712

bounded views, moving randomly, 231–232

creating, 50

display and interaction traits, 235–236

displaying data, 144

draggable views, 304–305

editing, 44–45

fading in and out, 237–238

flipping, 240–241

frames

adjusting sizes, 225–226

CGRect structure, 223–224, 227

overview, 224–225

utility methods, 227–231

geometry

keyboards, 154–155

navigation bars/toolbars/tab bars, 153–154

status bar, 151–152

text fields, 155

UIScreen class, 155

main view, replacing, 159–160

making choices, 145

moving, 179–182

naming, 184, 219–222

picker views, 484–487

reflections

creating, 251–252

masking with Core Graphics, 253–255

retrieving, 217–218

scroll views

creating multiimage paged scroll, 280–281

displaying images in scrollable view, 278–280

stacked views, 184

stretching, 349

subviews

adding, 216

querying, 214–215

removing, 216

reordering, 216

view callbacks, 216–217

swapping, 183, 239–240

table views, 424

tagging, 173–174, 217–218

temporary views, 198–199

touch-based painting, 321–323

touching, 303

transforming, 232

affine transform of UIView, 233–234

centering landscape views, 234–235

transitions

Core Animation calls, 244–246

Core Animation transitions, 242–244

curl transitions, 246–247

view geometry, 222–223

coordinate systems, 224

frame rectangles, 223–224

transforms, 224

view hierarchies, 211–212

recovering view hierarchy tree, 213

To Do List view hierarchy, 212–213

visualizing cell reuse, 445–446

Voice Chat (GameKit), 512–515

Voice Control, 799

VoiceOver accessibility

adding from code, 802–803

adding with Interface Builder, 799

enabling accessibility, 802

hints, 801

labels, 800–801

traits, 802

common VoiceOver gestures, 805–806

overview, 799

testing on iPhone, 803–806

testing with simulator, 803

volume alert, 420–421

Vulcano, Emanuele, 816

W

warnings, treating as errors, 98

Web servers, 582–586

Web sites, authentication challenges, 565–566

wheel tables, 480–484

WiFi connections, 528–537

window-based applications, 38

writing

collections to files, 135–136

photos to photo album, 268–270

strings to files, 127–128

WWDR intermediate certificate, 14

X—Y—Z

.xcdatamodel files, 758

Xcode

accessing SDKAPIs, 50–51

building custom buttons, 348–351

compiler directives, 73–76

debugger

breakpoints, 53–55

console, 55–57

customizing toolbars, 56–57

inspecting objects, 55

opening, 53

running, 53

zombies, 57

definition of, 4

projects

creating, 37–39

creating from scratch, 48–52

Detail pane, 41–42

editing views, 44–45

editor windows, 42

opening .xib files, 43–44

project files, list of, 43

project window, 40–41

running in simulator, 46

side-by-side code, viewing, 88

templates. See templates

toolbars, 385–386

Xcode identities, customizing, 85–86

Xcode Organizer. See Organizer

.xib files, 19

loading from code, 173–174

opening, 43–44

XML data, converting to tree data structures, 577–582

XMLParser class, 578

Yahoo Geocoding API, 717

zombies, enabling, 57

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

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