简体   繁体   中英

Best way to learn to master the AppKit framework

I've currently been learning Objective-C and Cocoa for some time but I feel that I need to know more about the AppKit framework. I'm often in doubt about which components I should use for specific uses. For example I've used much time researching how I should simply switch between two NSViews (in the same way as NSTabView but without its tabs and for example in an IBAction).

I've read Cocoa Programming for Mac OS X by Aaron Hillegass but I'm looking for what to read/do next to widen my knowledge about the AppKit framework and about developing user interfaces with Cocoa. What do you recommend me to take a look at?

Thank you in advance.

Four or five years ago, I was asking the same question. I had just finished Hillegass' book as well, and wasn't sure where to look for "more."

To be honest, what worked for me was learning by necessity. Think of an idea for an application you'd like to write, and just write it. The problems that you encounter along the way will help you ask more specific questions, and you'll quickly build your skill set. There's rarely a be-all, end-all answer to a programming question. Experiment, and you'll find out what works, what doesn't, and how to work your way from the latter to the former.

If you find yourself asking questions like, "Well, I guess I still don't know how to do something like A...", then either you can search for tutorials/forums on how to accomplish A, find the preferred or official alternative to A, or maybe you didn't really need to do A in the first place. (And you're just asking questions for the sake of asking questions.)

If you're really hell-bent on learning everything, you could always just read through Apple's documentation, or examine the classes/discussion at CocoaDev: http://www.cocoadev.com/index.pl?AppKit

Learn by tinkering. AppKit is pretty straight-forward, and using it like it was intended is dead simple. When you're trying to use a class, the documentation usually contains a helpful tutorial, and everything you need to know about the class.

When you come across a control that doesn't exist, or isn't easily available, don't be afraid to subclass and make your own versions. There's also lots of open-source controls and UI code out there on developer blogs. As always, Google and StackOverflow are your friends.

I agree with all of the above, (and I am still asking the same question you are), but I will add one more resource, if you haven't already discovered it. If you look up an AppKit class, such as NSProgressIndicator, for example, in the Apple Documentation, there will often be sample projects supplied by Apple, and you can use them to discover how they used the AppKit class. Unfortunately, some of these haven't been kept up to date, but they are still useful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM