Mark / LaMarche / Nutting | Learn Cocoa on the Mac | E-Book | www2.sack.de
E-Book

E-Book, Englisch, 400 Seiten

Mark / LaMarche / Nutting Learn Cocoa on the Mac


1. ed
ISBN: 978-1-4302-1860-9
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

E-Book, Englisch, 400 Seiten

ISBN: 978-1-4302-1860-9
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



The Cocoa frameworks are some of the most powerful frameworks for creating native desktop applications available on any platform today, and Apple gives them away, along with the Xcode development environment, for free! However, for a first-time Mac developer, just firing up Xcode and starting to browse the documentation can be a daunting task. The Objective-C class reference documentation alone would fill thousands of printed pages, not to mention all the other tutorials and guides included with Xcode. Where do you start? Which classes are you going to need to use? How do you use Xcode and the rest of the tools? This book answers these questions and more, helping you find your way through the jungle of classes, tools, and new concepts so that you can get started on the next great Mac OS X application today. Jack Nutting is your guide through this forest; he's lived here for years, and he'll show you which boulder to push, which vine to chop, and which stream to float across in order to make it through. You will learn not only how to use the components of this rich framework, but also which of them fit together, and why. Jack Nutting's approach, combining pragmatic problem-solving with a deep respect for the underlying design philosophies contained within Cocoa, stems from years of experience using these frameworks. He'll show you which parts of your application require you to jump in and code a solution, and which parts are best served by letting Cocoa take you where it wants you to go. The path over what looks like a mountain of components and APIs has never been more thoroughly prepared for your travels. With Jack's guidance, the steep learning curve becomes a pleasurable adventure. There is still much work for the uninitiated, but by the time you're done, you will be well on your way to becoming a Cocoa master.

Dave Mark is a longtime Mac developer and author who has written a number of books on Mac and iOS development, including Beginning iPhone 4 Development (Apress, 2010), More iPhone 3 Development (Apress, 2010), Learn C on the Mac (Apress, 2008), The Macintosh Programming Primer series (Addison-Wesley, 1992), and Ultimate Mac Programming (Wiley, 1995). Dave loves the water and spends as much time as possible on it, in it, or near it. He lives with his wife and three children in Virginia.

Mark / LaMarche / Nutting Learn Cocoa on the Mac jetzt bestellen!

Weitere Infos & Material


1;Title Page;1
2;Copyright Page;2
3;Contents at a Glance;3
4;Table of Contents;4
5;Foreword;10
6;About the Authors;11
7;About the Technical Reviewer;12
8;Acknowledgments;13
9;Preface;14
10;Chapter 1 Must Love Cocoa;15
10.1;Get a Mac and Download the Tools;16
10.2;Download the Source Code;17
10.3;Getting Help;17
10.4;What You Need to Know Before You Begin;17
10.5;Are You Ready?;18
11;Chapter 2 Hello, World;19
11.1;Building “Hello, World”;19
11.2;Exploring the Nib File;23
11.3;The Library;24
11.4;Dragging Out a Label;26
11.5;Using the Blue Guidelines;27
11.6;The Inspector Window;28
11.7;The Attributes Inspector;29
11.8;Change the Label’s Color and Font;31
11.9;Using the Menu Editor;33
11.10;Creating Your Application Icon;35
11.11;Adding Your Icon to Your Project;36
11.12;Property Lists;39
11.13;Running Your Application;39
11.14;Sharing Your Creation With the World;40
11.15;Goodbye, Hello World;42
12;Chapter 3 Lights, Camera… Actions! (and Outlets, Too);43
12.1;This Chapter’s Application;44
12.2;Frameworks, Frameworks Everywhere;44
12.2.1;The Foundation Framework;45
12.2.2;The AppKit Framework;45
12.3;The Cocoa Way: Model-View-Controller;46
12.4;Outlets, Actions, and Controllers;47
12.4.1;Declaring Outlets;47
12.4.2;Declaring Actions;48
12.5;Outlets and Actions in Action;49
12.5.1;Enabling Garbage Collection;49
12.5.2;Creating Our Controller Class;51
12.5.3;Declaring an Action and Outlet;52
12.5.4;Back to Interface Builder;53
12.5.4.1;Proxy Objects;54
12.5.4.2;Creating the Controller Instance;55
12.5.5;Setting Up the Window;56
12.5.6;Designing the Window’s Interface;60
12.5.7;Connecting the Outlet;62
12.5.8;Connecting the Buttons to Our Action;63
12.6;Implementing the Action Method;64
12.7;The Application Delegate;65
12.7.1;Configuring the Application to Quit on Window Close;66
12.7.2;Using the Documentation Browser;67
12.8;Bring It on Home;68
13;Chapter 4 GUI Components;69
13.1;Creating the VillainTracker Application;71
13.1.1;Creating the VillainTrackerAppDelegate Class;72
13.1.2;Planning for the GUI;74
13.2;Building Your Interface;76
13.2.1;Bringing Out Your Text Fields;76
13.2.2;Letting them Pick Dates;78
13.2.3;Creating the Combo Box;79
13.2.4;Indicating a Rating with a Level Indicator;80
13.2.5;Adding Radio Buttons in a Matrix;81
13.2.6;Adding an Image View;84
13.2.7;Adding Checkboxes in a Matrix;85
13.2.8;Configuring a Popup Button;86
13.2.9;Inserting a Text View;87
13.2.10;Making Logical Groupings;87
13.2.11;Resizing;90
13.2.12;Time for the Controller;92
13.2.13;Making All the Connections;92
13.3;Getting Started with Coding;94
13.3.1;Standardizing Key Names;94
13.3.2;Creating the Default Villain;95
13.3.3;Paying Attention to Detail;96
13.3.3.1;Setting Simple Values;97
13.3.3.2;Values in Complex Controls;98
13.3.4;Responding to Input;101
13.4;In Conclusion;104
14;Chapter 5 Using Table Views;105
14.1;Preparing AppController for Multiple Villains;105
14.2;Making Way for the Table View;107
14.3;Tweaking the Autosizing Characteristics;110
14.4;Making Some New Connections;112
14.5;Making Way for the Table View: Code Edition;113
14.6;The Table View Needs Your Help;114
14.7;Adding and Deleting Villains;116
14.8;In Conclusion;118
15;Chapter 6 Cocoa Bindings;119
15.1;Binding to Simple Controls;120
15.1.1;Create the DungeonThing Project;120
15.1.2;Create a Preferences Window;121
15.1.2.1;Add a Tab View;122
15.1.2.2;Character Generation Preferences;122
15.1.2.3;Monster Generation Preferences;124
15.1.2.4;Dungeon Generation Preferences;124
15.1.3;Binding to NSUserDefaultsController;125
15.1.3.1;Bindings for Character Generation;125
15.1.3.2;Bindings for Monster Generation;127
15.1.3.3;Bindings for Dungeon Generation;127
15.1.4;Create the Main Window;128
15.1.5;Set Up the DungeonThingAppDelegate;130
15.1.6;Define Your Constants;130
15.1.7;Specify Default Preferences Values;131
15.1.8;Create the Action Methods;132
15.2;Binding to a Table View;134
15.2.1;Make the Code Bindings-Ready;135
15.2.2;Show History in Tables;138
15.2.2.1;Dealing With Inconsistencies in Nib Files;138
15.2.2.2;Configuring the Table Views and Text Views;138
15.2.3;Create and Configure an Array Controller;140
15.2.4;Bind Table Display via the Array Controller;142
15.2.5;Bind a Text Field via the Array Controller’s Selection;142
15.2.6;Making Sure it Works;143
15.2.7;Rinse, Repeat, Rinse, Repeat;143
15.3;Okay, But How Did That Work?;143
15.3.1;Key-Value Coding;143
15.3.2;Key-Value Observing;145
15.3.3;Cocoa Bindings: How It Works;145
15.4;In Conclusion;146
16;Chapter 7 Core Data Basics;147
16.1;What You’ve Been Missing;147
16.2;Creating MythBase;149
16.2.1;Defining the Model;150
16.2.1.1;Using Xcode’s Model Editor;151
16.2.1.2;Creating an Entity;152
16.2.1.3;Creating Attributes;153
16.2.1.4;Attributes for Unsupported Types;155
16.2.2;The Automatic GUI;156
16.2.3;Refining the GUI;159
16.3;Exploring the Template Code;164
16.3.1;The App Delegate Interface;164
16.3.2;The App Delegate Implementation;166
16.3.2.1;The applicationSupportDirectory Method;166
16.3.2.2;The managedObjectModel Accessor Method;167
16.3.2.3;The persistentStoreCoordinator Accessor Method;168
16.3.2.4;The managedObjectContext Accessor Method;170
16.3.2.5;An NSWindow Delegate Method;170
16.3.2.6;The saveAction: Action Method;171
16.3.2.7;An NSApplication Delegate Method;171
16.3.2.8;The Obligatory Dealloc Method;173
16.4;Adding Business Logic;173
16.4.1;Validating Single Attributes;174
16.4.2;Validating Multiple Attributes;174
16.4.3;Creating a Custom Attribute;177
16.5;In Conclusion;178
17;Chapter 8 Core Data Relationships;179
17.1;Modeling New Entities and Relationships;180
17.1.1;Model Versioning and Migrations;181
17.1.2;Preparing for Multiple Model Versions;181
17.1.3;Adding New Entities;181
17.1.4;Add Relationships;182
17.1.5;Creating a Simple Migration;184
17.1.6;Time to Run;186
17.2;Updating the GUI;187
17.2.1;Create the Band Window;187
17.2.2;Giving Useful Names to Array Controllers;188
17.2.3;Putting People in Bands;189
17.2.4;Showing the Bands’ Members;191
17.2.5;Create a Venue Window;193
17.2.6;Adding a Gig List to the Band Window;193
17.3;Wrapping Up Relationships;195
18;Chapter 9 Search and Retrieve Core Data with Criteria;197
18.1;Creating QuoteMonger;197
18.1.1;Create the Project and Its Data Model;198
18.1.2;The Data Entry Window;199
18.1.2.1;A Two-Part Autogenerated Window;199
18.1.2.2;Smoothing Out the Rough Spots;200
18.1.2.3;Enter Some Initial Quotes;201
18.1.3;Creating the Quote Finder Window;202
18.2;Limiting Results with NSPredicate;203
18.2.1;Creating Predicates;203
18.2.2;Specifying an NSAppController’s Predicate in Interface Builder;205
18.3;User-Defined Predicates;205
18.3.1;Adding a Predicate to the App Delegate;206
18.3.2;Add a Predicate Editor to the Search Window;207
18.3.3;Configuring the Predicate Editor;207
18.4;Saving a Predicate;209
18.5;In Conclusion;210
19;Chapter 10 Windows and Menus and Sheets;211
19.1;NSWindow and NSPanel;211
19.1.1;Handling Input;213
19.1.2;To Use a Panel, or Not to Use a Panel;213
19.1.3;Window Attributes;214
19.1.4;Standard System Panels;215
19.1.4.1;The Color Panel;216
19.1.4.2;The Font Panel;218
19.1.5;A Controller With a Nib of Its Own;219
19.1.5.1;Loading a Nib With NSWindowController;220
19.1.5.2;Subclassing NSWindowController;221
19.1.6;Modal Windows;223
19.1.6.1;The NSAlert Functions;223
19.1.6.2;Open Panels and Save Panels;224
19.2;System Menus;225
19.2.1;Standard Application Menu Items;226
19.2.2;Your Own Menus;226
19.2.2.1;Enabling/Disabling With Bindings;227
19.2.2.2;Enabling/Disabling With First Responder;229
19.3;Sheets;232
19.4;Wrap-up;234
20;Chapter 11 Document-Based Applications;235
20.1;Creating the ColorMix Application;236
20.1.1;Examining the Default Nib Files;237
20.1.2;Defining the Model;237
20.2;Setting Two Colors;238
20.2.1;The Simplest of GUIs;239
20.2.2;Creating a Default ColorSet;240
20.3;Settling on a File Format;241
20.4;Adding Color;241
20.4.1;The ColorBlendView Class;242
20.4.2;Adding Blended Colors to the GUI;244
20.4.3;Adding Some Background Bling;248
20.5;About Undo and Redo;250
20.5.1;The Undo Stack;250
20.6;In Conclusion;251
21;Chapter 12 Exceptions, Signals, Errors, and Debugging;252
21.1;Exception Handling;252
21.1.1;Catching Exceptions;253
21.1.2;The Limited Role of Exceptions in Cocoa;254
21.1.3;Create a Test-bed;254
21.1.4;NSInvalidArgumentException;259
21.1.5;NSRangeException;262
21.1.6;And the Rest;263
21.2;Worse than Exceptions: Death by Signal;264
21.3;NSError;266
21.3.1;Domains and Codes;266
21.3.2;Realizing You Have an Error;267
21.3.3;Presenting an Error;271
21.4;In Conclusion;271
22;Chapter 13 Drawing in Cocoa;272
22.1;Fundamentals;272
22.1.1;The View Coordinate System;273
22.1.2;Frame Rectangle vs. Bounds Rectangle;273
22.1.3;Rects, Points, and Sizes;274
22.1.4;Path Basics;274
22.2;Creating an NSView Subclass;275
22.2.1;Some C Structures;275
22.2.2;The Basic Drawing Method, drawRect;276
22.2.3;Graphics States;276
22.2.4;Path Helpers;276
22.2.5;Colors and the Graphics Context;277
22.2.6;Beyond Color;278
22.2.7;Manual Path Construction;279
22.2.8;Pushing Boundaries;279
22.3;LOLmaker;282
22.3.1;First Steps to LOL;282
22.3.2;LOLView;284
22.3.2.1;Drawing a Bitmap;285
22.3.2.2;Let It Scroll;286
22.3.2.3;Drawing Text;288
22.4;Printing Basics;290
22.5;Wrapping Up;291
23;Chapter 14 Advanced Drawing Topics;292
23.1;Editing a Curve;292
23.1.1;Preparations;293
23.1.2;Bezier Plumbing;295
23.1.3;Drawing a Curve;296
23.1.4;Watching the Mouse;298
23.1.5;A Little Polish;300
23.2;Core Animation: A Primer;301
23.2.1;Core Animation Basics;302
23.2.2;Implicit Animations;302
23.2.3;Explicit Animations;303
23.2.4;Grouping Animations;308
23.3;What Have We Done?;315
24;Chapter 15 Working with Files;316
24.1;Implicit File Access;316
24.2;High-level File Operations;317
24.2.1;What About That File: The Code;318
24.2.2;What About That File: The GUI;323
24.3;Filing It All Away;327
25;Chapter 16 Concurrency;328
25.1;SlowWorker;329
25.2;Threading Basics;331
25.2.1;Units of Work;332
25.2.2;Operation Queues;333
25.3;Vitalizing SlowWorker;333
25.3.1;Extending NSObject;336
25.3.2;Demanding the Main Thread;337
25.4;GCD: Low-Level Queuing;342
25.4.1;Becoming a Blockhead;343
25.4.2;Improving SlowWorker a Second Time;344
25.4.2.1;Don’t Forget That Main Thread;345
25.4.2.2;Concurrent Blocks;345
25.4.3;Another Option: NSBlockOperation;346
25.5;A Little Concurrency Goes a Long Way;347
26;Chapter 17 Future Paths;348
26.1;More Cocoa-isms;348
26.1.1;Notifications;349
26.1.2;Blocks;350
26.1.2.1;Enumeration;350
26.1.2.2;Observing Notifications Using Blocks;352
26.1.2.3;Filtering;352
26.2;Cocoa in a Foreign Language;352
26.2.1;PyObjC;353
26.2.2;MacRuby;354
26.2.3;Nu;355
26.2.4;JavaScript;355
26.2.5;F-Script;356
26.3;Ported Cocoa;356
26.3.1;Cocoa Touch;357
26.3.2;GNUstep and Cocotron;357
26.3.3;Cappuccino/Objective-J;358
26.4;Here at the End of All Things;359
27;Index;360



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.