ccl 和 *.nib 文件
我是 ccl 新手,想知道如何在 *.nib 文件内的对象和 ccl 之间“通信”?我浏览了“Apple 在 Lisp 中的货币转换器”教程,但我不确定这两者是如何“通信”在一起的。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我是 ccl 新手,想知道如何在 *.nib 文件内的对象和 ccl 之间“通信”?我浏览了“Apple 在 Lisp 中的货币转换器”教程,但我不确定这两者是如何“通信”在一起的。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
我贡献了一些教程以及大量使用 CCL 开发 Cocoa 应用程序的代码。其中包括有关如何在 CCL 中创建和使用 NIB 文件的大量讨论。它都是 CCL 发行版的一部分(获取最新代码的主干发行版)。或者您可以在 CCL 网站。
I have contributed a couple of tutorials plus a substantial amount of code for developing Cocoa applications using CCL. This includes much discussion about how to create and use NIB files in CCL. It's all part of the CCL distribution (get the trunk distribution for the most current code). Or you can browse the code on the CCL website.
任何编程语言中的 Cocoa 在程序启动时都会自动执行很多操作:
加载任何 nib 文件都会执行以下操作:
因此,一旦加载 nib 文件,就会有一个代表按钮的活动对象,该对象被配置为调用您在 Objective-C 或 lisp 或其他中定义的方法。因此,当您单击按钮时,事件调度程序会找到按钮,按钮然后调用您定义的方法,lisp 执行设置 UI 新状态的方法,UI 自行刷新等等。
这些概念部分并不重要。无论您使用 Objective-C、Lisp 还是 Ruby,都不会真正改变。因此,请阅读 Apple 的 Cocoa 基础知识中的此部分。同一文档的其他部分也非常好。
Cocoa in any programming language does a lot of things automatically when the program is launched:
Loading of any nib file does a few things:
So, once the nib file is loaded, there is a live object representing the button, which is configured to call a method you defined in Objective-C or lisp or whatever. Therefore, when you click the button, the event dispatcher finds the button, the button then calls the method you defined, the lisp executes the method which sets the new state of the UI, the UI refreshes itself, etc.
These conceptual part doesn't really change whether you use Objective-C or Lisp or Ruby. So, please read this section in Apple's Cocoa Fundamentals. Other parts of the same document is quite good, too.