学习掌握 AppKit 框架的最佳方式
我目前已经学习 Objective-C 和 Cocoa 一段时间了,但我觉得我需要更多地了解 AppKit 框架。我经常怀疑应该将哪些组件用于特定用途。例如,我花了很多时间研究如何在两个 NSView 之间简单地切换(与 NSTabView 相同,但没有其选项卡,例如在 IBAction 中)。
我已经阅读了 Aaron Hillegass 的 Mac OS X 的 Cocoa 编程,但我正在寻找接下来要阅读/做什么的内容,以扩大我对 AppKit 框架以及使用 Cocoa 开发用户界面的了解。 您建议我看什么?
先感谢您。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
四五年前,我也问过同样的问题。我也刚刚读完希勒加斯的书,不知道去哪里寻找“更多”。
老实说,对我有用的是必要的学习。想出一个您想要编写的应用程序的想法,然后编写它。您在此过程中遇到的问题将帮助您提出更具体的问题,并且您将快速建立自己的技能。编程问题很少有一个全面、最终的答案。尝试一下,你就会发现什么有效,什么无效,以及如何从后者过渡到前者。
如果您发现自己问这样的问题,“好吧,我想我仍然不知道如何做 A 这样的事情......”,那么您可以搜索有关如何完成 A 的教程/论坛,找到首选或官方的A 的替代方案,或者也许您一开始就不需要做 A。 (而且你只是为了问问题而问问题。)
如果你真的一心想学习所有东西,你总是可以阅读 Apple 的文档,或者检查 CocoaDev 的课程/讨论:http://www.cocoadev.com/index.pl?AppKit
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
通过修补来学习。 AppKit 非常简单,并且按照预期使用它非常简单。当您尝试使用某个类时,文档通常包含有用的教程以及您需要了解的有关该类的所有信息。
当您遇到不存在或不易获得的控件时,不要害怕子类化并创建自己的版本。开发人员博客上还有大量开源控件和 UI 代码。一如既往,Google 和 StackOverflow 是您的朋友。
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.
我同意上述所有内容(并且我仍然在问您同样的问题),但如果您还没有发现的话,我将添加一个资源。如果您在 Apple 文档中查找 AppKit 类(例如 NSProgressIndicator),通常会有 Apple 提供的示例项目,您可以使用它们来了解他们如何使用 AppKit 类。不幸的是,其中一些尚未保持最新,但它们仍然有用。
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.