| Title Page | 1 |
|---|
| Copyright Page | 2 |
|---|
| Contents at a Glance | 3 |
|---|
| Table of Contents | 4 |
|---|
| Foreword | 10 |
|---|
| About the Authors | 11 |
|---|
| About the Technical Reviewer | 12 |
|---|
| Acknowledgments | 13 |
|---|
| Preface | 14 |
|---|
| Chapter 1 Must Love Cocoa | 15 |
|---|
| Get a Mac and Download the Tools | 16 |
| Download the Source Code | 17 |
| Getting Help | 17 |
| What You Need to Know Before You Begin | 17 |
| Are You Ready? | 18 |
| Chapter 2 Hello, World | 19 |
|---|
| Building Hello, World | 19 |
| Exploring the Nib File | 23 |
| The Library | 24 |
| Dragging Out a Label | 26 |
| Using the Blue Guidelines | 27 |
| The Inspector Window | 28 |
| The Attributes Inspector | 29 |
| Change the Label s Color and Font | 31 |
| Using the Menu Editor | 33 |
| Creating Your Application Icon | 35 |
| Adding Your Icon to Your Project | 36 |
| Property Lists | 39 |
| Running Your Application | 39 |
| Sharing Your Creation With the World | 40 |
| Goodbye, Hello World | 42 |
| Chapter 3 Lights, Camera Actions! (and Outlets, Too) | 43 |
|---|
| This Chapter s Application | 44 |
| Frameworks, Frameworks Everywhere | 44 |
| The Foundation Framework | 45 |
| The AppKit Framework | 45 |
| The Cocoa Way: Model-View-Controller | 46 |
| Outlets, Actions, and Controllers | 47 |
| Declaring Outlets | 47 |
| Declaring Actions | 48 |
| Outlets and Actions in Action | 49 |
| Enabling Garbage Collection | 49 |
| Creating Our Controller Class | 51 |
| Declaring an Action and Outlet | 52 |
| Back to Interface Builder | 53 |
| Proxy Objects | 54 |
| Creating the Controller Instance | 55 |
| Setting Up the Window | 56 |
| Designing the Window s Interface | 60 |
| Connecting the Outlet | 62 |
| Connecting the Buttons to Our Action | 63 |
| Implementing the Action Method | 64 |
| The Application Delegate | 65 |
| Configuring the Application to Quit on Window Close | 66 |
| Using the Documentation Browser | 67 |
| Bring It on Home | 68 |
| Chapter 4 GUI Components | 69 |
|---|
| Creating the VillainTracker Application | 71 |
| Creating the VillainTrackerAppDelegate Class | 72 |
| Planning for the GUI | 74 |
| Building Your Interface | 76 |
| Bringing Out Your Text Fields | 76 |
| Letting them Pick Dates | 78 |
| Creating the Combo Box | 79 |
| Indicating a Rating with a Level Indicator | 80 |
| Adding Radio Buttons in a Matrix | 81 |
| Adding an Image View | 84 |
| Adding Checkboxes in a Matrix | 85 |
| Configuring a Popup Button | 86 |
| Inserting a Text View | 87 |
| Making Logical Groupings | 87 |
| Resizing | 90 |
| Time for the Controller | 92 |
| Making All the Connections | 92 |
| Getting Started with Coding | 94 |
| Standardizing Key Names | 94 |
| Creating the Default Villain | 95 |
| Paying Attention to Detail | 96 |
| Setting Simple Values | 97 |
| Values in Complex Controls | 98 |
| Responding to Input | 101 |
| In Conclusion | 104 |
| Chapter 5 Using Table Views | 105 |
|---|
| Preparing AppController for Multiple Villains | 105 |
| Making Way for the Table View | 107 |
| Tweaking the Autosizing Characteristics | 110 |
| Making Some New Connections | 112 |
| Making Way for the Table View: Code Edition | 113 |
| The Table View Needs Your Help | 114 |
| Adding and Deleting Villains | 116 |
| In Conclusion | 118 |
| Chapter 6 Cocoa Bindings | 119 |
|---|
| Binding to Simple Controls | 120 |
| Create the DungeonThing Project | 120 |
| Create a Preferences Window | 121 |
| Add a Tab View | 122 |
| Character Generation Preferences | 122 |
| Monster Generation Preferences | 124 |
| Dungeon Generation Preferences | 124 |
| Binding to NSUserDefaultsController | 125 |
| Bindings for Character Generation | 125 |
| Bindings for Monster Generation | 127 |
| Bindings for Dungeon Generation | 127 |
| Create the Main Window | 128 |
| Set Up the DungeonThingAppDelegate | 130 |
| Define Your Constants | 130 |
| Specify Default Preferences Values | 131 |
| Create the Action Methods | 132 |
| Binding to a Table View | 134 |
| Make the Code Bindings-Ready | 135 |
| Show History in Tables | 138 |
| Dealing With Inconsistencies in Nib Files | 138 |
| Configuring the Table Views and Text Views | 138 |
| Create and C
|