Cocoa (Developer Reference)
Format: PDF / Kindle (mobi) / ePub
Develop applications for Mac OS X with this Developer Reference guide
Make a clean transition to programming in Apple environments using the elegant and dynamic programming API Cocoa and this practical guide. Written by aseasoned Mac expert, this book shows you how to write programs in Cocoa for the rapidly expanding world of Macintosh users.
Part of the Developer Reference series, this book prepares you for a productive programming experience on today's fastest-growing platform.
- Cocoa is a programming framework for developing in Apple environments, including Mac OS X 10.6 Snow Leopard
- This book covers all the major information you need to start developing dynamic applications for Mac OS X
- Master all Cocoa tools, including Xcode and working with Objective-C
- Includes full coverage of the Cocoa API, Xcode, and Objective-C, as well as programming for Apple's latest OS X, Snow Leopard
- Companion Web site includes all code files
Programming for Apple's Macintosh is a growing career field. This essential guide, one of the most comprehensive on Cocoa, will help you quickly become productive.
character Objective-C uses the @ character as an objectification operator that converts whatever follows into an object. This is most often used in text string definitions. In other languages, you delimit a string with quote marks. In Objective-C, you must also prepend the @ character to convert the string into an object. For example: NSLog(@”This is a string”); This prints “This is a string” using Cocoa’s NSLog class, which logs output to a console window. You can also use the C-function
Composer is a useful and entertaining feature included with Xcode, but you don’t need to use it or know about it to create working applications. It’s worth looking through this section because it contains some useful content, including information about using features of Xcode that are hidden behind its GUI (graphical user interface). You can use this content to customize and optimize Xcode if you choose to. Initially, you can treat this section as a collection of extra material and not an
get x get y get z get sumOfxyz Foo *anInstance 09_495896-ch05.indd 99 Foo *anotherInstance properties properties x=3 y=4 z=5 x = −3 y = 123456 z=0 methods methods init init set x set y set z set x set y set z get x get y get z get x get y get z get sumOfxyz get sumOfxyz 8/31/10 2:43 PM 100 Getting Started Creating implicit and explicit instances It’s critically important to understand that an application can create object instances explicitly with Objective-C code or
timesaver. You can use it to search the documentation for any highlighted string. Exploring class references Class references are single scrollable pages. NSWindow is a complicated class with many features, so the reference is long and detailed. The most efficient way to explore it is to use the Table of Contents list that appears in the pane to the left of the main window. You can use the reference information in various ways. When looking for a list of possible features, it’s useful to scan
You can also use the backspace-delete key. To add items to the nib, drag them across from the Objects list in the Library window. The hierarchy is interpreted by different objects in different ways. To see an example, click the reveal triangle next to the Main Menu object. For a menu, the hierarchy defines menu headings, followed by lists of menu items. For a window, the hierarchy defines the objects that appear inside the window, and it also sets the order in which they’re drawn. It’s possible