Cocoa Programming for Mac OS X (4th Edition) and over one million other books are available for Amazon Kindle. Learn more

Vous voulez voir cette page en français ? Cliquez ici.

Sign in to turn on 1-Click ordering.
Amazon Prime Free Trial required. Sign up when you check out. Learn More
More Buying Choices
Have one to sell? Sell yours here
Start reading Cocoa Programming for Mac OS X (4th Edition) on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Cocoa Programming for Mac OS X (4th Edition) [Paperback]

Aaron Hillegass , Adam Preble
5.0 out of 5 stars  See all reviews (2 customer reviews)
List Price: CDN$ 51.99
Price: CDN$ 32.59 & FREE Shipping. Details
You Save: CDN$ 19.40 (37%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Only 1 left in stock (more on the way).
Ships from and sold by Gift-wrap available.
Want it delivered Tuesday, April 22? Choose One-Day Shipping at checkout.
‹  Return to Product Overview

Table of Contents

Preface xix

Acknowledgments xxi


Chapter 1: Cocoa: What Is It? 1

A Little History 1

Tools 3

Language 4

Objects, Classes, Methods, and Messages 5

Frameworks 6

How to Read This Book 7

Typographical Conventions 7

Common Mistakes 8

How to Learn 8


Chapter 2: Let’s Get Started 11

In Xcode 11

In Interface Builder 15

A Look at Objective-C 25

Documentation 31

What Have You Done? 31

Chronology of an Application 32


Chapter 3: Objective-C 35

Creating and Using Instances 35

Using Existing Classes 37

Creating Your Own Classes 48

The Debugger 58

What Have You Done? 63

Meet the Static Analyzer 63

For the More Curious: How Does Messaging Work? 65

Challenge 66


Chapter 4: Memory Management 67

Living with Manual Reference Counting 69

Accessor Methods 77

Living with ARC 80


Chapter 5: Target/Action 83

Some Commonly Used Subclasses of NSControl 85

Start the SpeakLine Example 89

Lay Out the XIB File 90

Implementing the SpeakLineAppDelegate Class 94

For the More Curious: Setting the Target Programmatically 96

Challenge 96

Debugging Hints 98


Chapter 6: Helper Objects 99

Delegates 100

The NSTableView and Its dataSource 104

Lay Out the User Interface 107

Make Connections 109

Edit SpeakLineAppDelegate.m 110

For the More Curious: How Delegates Work 113

Challenge: Make a Delegate 114

Challenge: Make a Data Source 114


Chapter 7: Key-Value Coding and Key-Value Observing 117

Key-Value Coding 117

Bindings 119

Key-Value Observing 120

Making Keys Observable 121

Properties 124

For the More Curious: Key Paths 126

For the More Curious: Key-Value Observing 127


Chapter 8: NSArrayController 129

Starting the RaiseMan Application 130

Key-Value Coding and nil 139

Add Sorting 140

For the More Curious: Sorting without NSArrayController 141

Challenge 1 142

Challenge 2 142


Chapter 9: NSUndoManager 145

NSInvocation 145

How the NSUndoManager Works 146

Adding Undo to RaiseMan 148

Key-Value Observing 152

Undo for Edits 153

Begin Editing on Insert 156

For the More Curious: Windows and the Undo Manager 158


Chapter 10: Archiving 159

NSCoder and NSCoding 160

The Document Architecture 163

Saving and NSKeyedArchiver 167

Loading and NSKeyedUnarchiver 168

Setting the Extension and Icon for the File Type 170

For the More Curious: Preventing Infinite Loops 172

For the More Curious: Creating a Protocol 173

For the More Curious: Automatic Document Saving 174

For the More Curious: Document-Based Applications without Undo 175

Universal Type Identifiers 175


Chapter 11: Basic Core Data 177

NSManagedObjectModel 177

Interface 179

For the More Curious: View-Based versus Cell-Based Table Views 191

Challenge 191


Chapter 12: NIB Files and NSWindowController 193

NSPanel 193

Adding a Panel to the Application 194

For the More Curious: NSBundle 204

Challenge 206


Chapter 13: User Defaults 207

NSDictionary and NSMutableDictionary 208

NSUserDefaults 210

Setting Defaults 212

Letting the User Edit the Defaults 213

Using the Defaults 215

For the More Curious: NSUserDefaultsController 217

For the More Curious: Reading and Writing Defaults from the Command Line 217

Challenge 219


Chapter 14: Using Notifications 221

What Notifications Are and Are Not 221

What Notifications Are Not 222

NSNotification 222

NSNotificationCenter 222

Posting a Notification 224

Registering as an Observer 225

Handling the Notification When It Arrives 226

The userInfo Dictionary 226

For the More Curious: Delegates and Notifications 227

Challenge 228


Chapter 15: Using Alert Panels 229

Make the User Confirm the Deletion 230

Challenge 232


Chapter 16: Localization 233

Localizing a NIB File 234

String Tables 236

For the More Curious: ibtool 239

For the More Curious: Explicit Ordering of Tokens in Format Strings 240


Chapter 17: Custom Views 241

The View Hierarchy 241

Get a View to Draw Itself 243

Drawing with NSBezierPath 248

NSScrollView 250

Creating Views Programmatically 252

For the More Curious: Cells 253

For the More Curious: isFlipped 255

Challenge 255


Chapter 18: Images and Mouse Events 257

NSResponder 257

NSEvent 257

Getting Mouse Events 259

Using NSOpenPanel 259

Composite an Image onto Your View 264

The View’s Coordinate System 266

Autoscrolling 268

For the More Curious: NSImage 269

Challenge 270


Chapter 19: Keyboard Events 271

NSResponder 273

NSEvent 273

Create a New Project with a Custom View 274

For the More Curious: Rollovers 282

The Fuzzy Blue Box 284


Chapter 20: Drawing Text with Attributes 285

NSFont 285

NSAttributedString 286

Drawing Strings and Attributed Strings 289

Making Letters Appear 289

Getting Your View to Generate PDF Data 291

For the More Curious: NSFontManager 293

Challenge 1 293

Challenge 2 294


Chapter 21: Pasteboards and Nil-Targeted Actions 295

NSPasteboard 296

Add Cut, Copy, and Paste to BigLetterView 298

Nil-Targeted Actions 300

For the More Curious: Which Object Sends the Action Message? 303

amznJQ.available("jQuery", function() { var seeAllCustomerImage = jQuery("#see-all-customer-image-and-share"); var seeAllCustomerImagelinkHtml = 'Share your own customer images'; seeAllCustomerImage.append(seeAllCustomerImagelinkHtml); });

‹  Return to Product Overview