Warner / Privat Beginning OS X Lion Apps Development
1. Auflage 2012
ISBN: 978-1-4302-3721-1
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark
E-Book, Englisch, 387 Seiten, eBook
ISBN: 978-1-4302-3721-1
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark
With the Mac App Store launch in early 2011, a new age in Mac development began. Look for many of the cool apps for iPhone and iPad coming to an iMac or MacBook Pro near you!
Beginning OS X Lion Apps Development explains how to develop OS X Lion-based apps and publish them in the Mac App Store. It begins with the basics of Objective-C and Cocoa, and then moves through all the topics necessary to build and publish your first successful Mac apps!
Get started with Objective-C and Xcode
Build your first complete apps that integrate well with Mac OS X
Publish your apps on the Mac App Store
If you're new to Mac or new to iPhone or iPad apps development, and looking to develop apps for the Macbook Pro or Mac desktop, this book is for you!
Zielgruppe
Popular/general
Autoren/Hrsg.
Weitere Infos & Material
1;Title page;2
2;Copyright page;3
3;Contents at a Glance;5
4;Table of contents;6
5;About the Authors;11
6;Acknowledgments;13
7;Introduction;15
7.1;The Premise;15
7.2;The Audience;15
7.3;How This Book Is Organized;16
7.4;Source Code and Errata;16
7.5;How to Contact Us;16
8;Chapter 1 Starting to Build a Graphing Calculator;17
8.1;Using the Xcode Development Tools;18
8.1.1;Obtaining Xcode;18
8.1.2;Installing Xcode;19
8.1.3;Installing from the Web Download;19
8.1.4;Installing from the App Store;25
8.1.5;Understanding Xcode;28
8.1.6;The Editor Area and the Jump Bar;32
8.1.7;The Navigator Area and the Navigator Selector Bar;33
8.1.7.1;The Filter Bar;33
8.1.7.2;The Debug Area and the Debug Bar;33
8.1.7.3;The Inspector Pane, the Inspector Selector Bar, and the Library Pane;34
8.1.7.4;The View Selector;34
8.1.7.5;The Editor Selector;34
8.1.7.6;The Toolbar;34
8.2;Creating a Project;35
8.3;Understanding the Major Components;39
8.3.1;The Project and Targets;40
8.3.2;The Application Architecture;43
8.3.3;The Source Code and Resources;44
8.3.4;The About Dialog;50
8.4;Summary;51
9;Chapter 2 Laying Out the User Interface;52
9.1;Creating the Split View;53
9.1.1;Creating the Horizontal NSSplitView;54
9.1.2;Creating the Vertical NSSplitView;58
9.2;Creating the Equation Entry Panel;60
9.2.1;Using NSViewController;61
9.2.2;Laying Out the Custom Equation Entry Component;63
9.2.3;A Primer on Automatic Reference Counting;64
9.2.4;Using IBOutlet;65
9.2.5;Hooking Up the New Component to the Application;66
9.2.6;Resizing the Views Automatically;68
9.2.7;Further Customizing the Components;71
9.3;Creating the Graph Panel;72
9.3.1;Adding the Horizontal Slider;73
9.3.2;Adding the Table View;75
9.3.3;Adding the Graph Panel to the Application;76
9.4;Creating the Table of Recently Used Equations;77
9.4.1;Creating the Data Source;82
9.4.2;Displaying the Data;84
9.5;Adding a Toolbar;86
9.6;Summary;87
10;Chapter 3 Handling User Input;88
10.1;Resizing the Views;89
10.1.1;Resizing the Window;89
10.1.2;Constraining the Split View Sizes;91
10.1.2.1;Constraining the Minimum Size;91
10.1.2.2;Constraining the Maximum Size;92
10.1.3;Constraining the Window Size;94
10.1.4;Collapsing a Subview;98
10.2;Handling Button Presses;100
10.2.1;The Model-View-Controller Pattern;100
10.2.2;Using IBAction;100
10.2.3;Creating the Model: Equation;102
10.2.4;Communication Among Controllers;105
10.3;Validating Fields;106
10.3.1;Validating After Submitting;106
10.3.1.1;Writing a Validator;107
10.3.1.2;Unit Testing;109
10.3.1.3;Displaying an Alert Window;114
10.3.2;A Better Way: Real-Time Validation;115
10.3.2.1;Adding a Feedback Label;115
10.3.2.2;Catching Text Change Notifications;116
10.3.2.3;Wiring It All Together in Interface Builder;117
10.4;Graphing the Data;119
10.4.1;Calculating and Caching the Data;121
10.4.2;Talking to the Table: Outlets and Delegates;123
10.5;Changing the Interval in the Domain;127
10.5.1;Using Key-Value Coding;128
10.5.2;Binding the Value to the Slider;129
10.6;Summary;132
11;Chapter 4 Pimp My UI;133
11.1;Creating a Graph View;134
11.1.1;Creating a Custom View;134
11.1.2;Linking the New Custom View to the Controller;135
11.1.3;Plotting the Graph;138
11.1.3.1;Finding the Boundaries;138
11.1.3.2;Painting the Background;139
11.1.3.3;Plotting the Graph;139
11.2;Toggling Between Text and Graph;143
11.2.1;Adding the Tab View;144
11.2.2;Adding the Views to the Tabs;146
11.2.3;Switching the Controller to the Tab View;148
11.3;Creating a Smarter Equation Editor;150
11.3.1;Adding Attributes to the Equation Entry Field;151
11.3.2;Creating the Tokens;152
11.3.3;Parsing the Equation;154
11.3.4;Implementing the Method to Tokenize the Equation;156
11.3.4.1;Converting a String to a Token;157
11.3.4.2;Recognizing Numbers;159
11.3.4.3;Grouping Spaces;160
11.3.4.4;Recognizing Trigonometric Functions and Symbols;162
11.3.4.5;Recognizing Exponents;164
11.3.4.6;Creating a Stack for Parenthesis Matching;169
11.3.4.6.1;Creating the Stack Class;170
11.3.4.6.2;Testing the Stack Class;171
11.3.4.6.3;Balancing Parentheses Using Stack;172
11.3.5;Detecting Multiple Decimal Points;175
11.3.6;Testing the Tokenizer;178
11.3.6.1;Testing Simple Equations;179
11.3.6.2;Testing Exponents;179
11.3.6.3;Testing Whitespace;180
11.3.6.4;Testing Trigonometric Functions and Symbols;181
11.3.6.5;Testing Parenthesis Matching;182
11.3.6.6;Testing Invalid Cases;183
11.3.7;Showing the Equation;183
11.3.7.1;Setting the Colors;184
11.3.7.2;Colorizing the Equation;185
11.3.7.3;Superscripting Exponents;187
11.3.8;Updating the Validator;189
11.3.9;Updating the Evaluator;191
11.4;Summary;196
12;Chapter 5 User Preferences and the File System;197
12.1;Managing User Preferences;198
12.1.1;Understanding NSUserDefaults;200
12.1.1.1;Persisting Default Values;200
12.1.1.2;Understanding Search Domains;200
12.1.1.3;Resetting Defaults to Reasonable Values;202
12.1.2;Setting the Font for the Equation Entry Field;202
12.1.2.1;Responding to Font Changes;205
12.1.2.2;Applying the New Font;207
12.1.3;Setting the Line Color;210
12.1.3.1;Understanding Color Selection Modes;211
12.1.3.2;Displaying the Color Selection Panel;212
12.1.3.3;Responding to Color Changes;213
12.1.4;Creating a Custom Preferences Panel;215
12.1.4.1;Creating the Preferences View;216
12.1.4.2;Displaying the Preferences Panel;218
12.1.4.3;Using the Custom Preference;221
12.2;Using the Local File System;222
12.2.1;Browsing the File System;223
12.2.1.1;Enumerating Through the Mounted Volumes;223
12.2.1.2;Enumerating Through a Folder;223
12.2.2;Writing to the File System;224
12.2.3;Reading from the File System;225
12.2.4;Exporting Graphs as Images;225
12.2.4.1;Creating an Image from a View;225
12.2.4.2;Adding the Export Graph Menu Item;227
12.3;Summary;230
13;Chapter 6 Using Core Data;231
13.1;Stepping Up to Core Data;232
13.2;Adding Core Data to the Graphique Application;232
13.2.1;Adding the Core Data Framework;232
13.2.2;Creating a Data Model;235
13.2.3;Designing the Data Model;236
13.2.4;Initialize the Managed Object Context;243
13.3;Storing Recently Used Equations;246
13.3.1;Querying the Persistent Store to Get the Group Entity;248
13.3.2;Creating the Equation Managed Object and Adding It to the Persistent Store;249
13.3.3;Committing;249
13.3.4;Putting Everything Together into the Final Method;250
13.4;Reloading Recently Used Equations;251
13.5;Tightening the Control over the Outline View;257
13.5.1;Using NSOutlineViewDelegate;257
13.5.2;Handling Equations Selection;258
13.5.3;Preventing Double-Clicks from Editing;259
13.6;Summary;260
14;Chapter 7 Integrating Graphique into the Mac OS X Desktop;261
14.1;Dealing with Graphique XML Files;261
14.1.1;Producing a Graphique File;261
14.1.1.1;Creating a Save As Method;262
14.1.1.2;Grabbing the Current Equation;263
14.1.1.3;Prompting the User to Select a Destination File;264
14.1.1.4;Producing the Graphique File;264
14.1.2;Loading a Graphique File into the Application;266
14.2;Registering File Types with Lion;267
14.2.1;Defining the New UTI for the .graphique Extension;267
14.2.2;Registering Graphique as an Editor for Graphique Files;269
14.2.3;Handling Graphique Equation Files;271
14.3;Using Quick Look to Generate Previews and Thumbnails;273
14.3.1;Creating the Quick Look Plug-in;275
14.3.2;Implementing the Preview;278
14.3.3;Testing the Plug-in;281
14.3.4;Implementing the Thumbnail;285
14.3.5;Distributing the Quick Look Plug-in with the Graphique Application;289
14.3.5.1;Copying the Plug-in;290
14.4;Adding an Item to the Menu Bar;291
14.4.1;Understanding NSStatusBar and NSStatusItem;291
14.4.2;Adding a Status Item to Graphique;292
14.4.3;Building the Status Item Menu;293
14.4.4;Integrating the Status Item;296
14.4.5;Heeding Apple’s Advice Regarding Menu Bar Icons;298
14.4.5.1;Adding the Preference to the Interface;299
14.5;Summary;302
15;Chapter 8 Creating Help;303
15.1;A Word on Help;304
15.2;Understanding Help Books;304
15.3;Creating Your Help Book;305
15.3.1;Creating the Directory Structure;305
15.3.2;Creating the Main Help File;306
15.3.3;Creating the Rest of Your Help Files;308
15.3.4;Creating the Help Index;311
15.3.5;Setting Up Your Plist File;311
15.3.6;Importing Your Help Book into Your Xcode Project;314
15.3.7;Updating Your Application’s Plist File;315
15.4;Viewing the Help;316
15.5;Bookmarking a Page;317
15.6;Performing a Search;318
15.7;Summary;320
16;Chapter 9 Printing;321
16.1;Printing the Graph View;321
16.1.1;Printing the Graph;321
16.1.1.1;Implementing the Method to Print;324
16.1.1.2;Wiring the Method to the Menu;324
16.1.1.3;Sizing the Printed View;328
16.1.2;Drawing for the Printer;330
16.2;Spanning to Multiple Pages;332
16.2.1;Calculating the Number of Pages;333
16.2.2;Determining the Page Size;334
16.2.3;Drawing the Page;335
16.3;Summary;336
17;Chapter 10 Submitting to the Mac App Store;337
17.1;Reviewing the Guidelines;337
17.2;Finishing the App;338
17.2.1;Terminating Graphique When Its Window Closes;338
17.2.2;Adding the Icon;338
17.2.3;Reviewing the Property List File;341
17.2.4;Cleaning Up the Menu;342
17.2.4.1;Finishing the About Box;342
17.2.4.2;Centering the Preferences Panel;343
17.2.4.3;Removing Unused Menu Items;344
17.2.4.4;Adding a Menu Item for Full-Screen;344
17.2.5;Setting the Initial Window Size and Location;345
17.2.6;Signing the Code;348
17.2.6.1;Using the Developer Certificate Utility;348
17.2.6.2;Registering Your App IDs;349
17.2.6.3;Installing Apple’s Certificate;351
17.2.6.4;Creating the Provisioning Profile;358
17.2.6.5;Configuring the Build to Sign the Code;362
17.2.7;Sandboxing the App;363
17.2.7.1;What Is Sandboxing?;363
17.2.7.2;What Are Entitlements?;364
17.2.7.3;Establishing the Sandbox;365
17.2.8;Building for Release;366
17.3;Setting Up Your Web Site;367
17.3.1;Using the Artwork;368
17.3.2;Creating the Web Site;368
17.4;Submitting the App;370
17.4.1;Setting Up Your iTunes Connect Account;370
17.4.2;Uploading Your Application;371
17.4.2.1;Setting the App Name;371
17.4.2.2;Selecting Availability and Pricing;371
17.4.2.3;Entering Additional Information;371
17.4.2.3.1;Metadata;372
17.4.2.3.2;Rating;373
17.4.2.3.3;EULA;373
17.4.2.3.4;Uploads;373
17.4.2.4;Performing the Upload;374
17.5;Summary;377
18;Index;378