developer.apple.com 上的教程与 Xcode 项目模板之间的差异
我正在关注 developer.apple 的教程.com 学习 Cocoa,我在我的项目中发现了教程中没有的东西。就是我开始项目的时候做的Application Delegate。在他们的教程中,它在界面生成器中显示了这一点:
我在 Mac 上的文件,在界面生成器中打开,看起来像这样:
另外,我无法将 Controller 类添加到我的 xib 文件中。它给了我错误:
已解析 1 个源文件,但未找到或更改任何类。
教程是旧的还是我做错了什么?什么是 App Delegate 类?
I was following the tutorial at developer.apple.com for learning Cocoa, and I found something in my project that was not in the tutorial. It was the Application Delegate that was made when I started the project. In their tutorial it shows this in interface builder:
The file I have on my Mac, opened in Interface Builder, looks like this:
Also, I cannot add the Controller class to my xib file. It gives me the error:
Parsed 1 source file, but no classes were found or changed.
Is the tutorial old or am I doing something wrong? And what is the App Delegate class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该教程很旧,但为了回答您的问题,App Delegate 是一个实现 NSApplicationDelegate 协议的 NSObject。更多信息请此处。
您无需对本课程执行与您的教程相关的任何操作。当您编写更高级的程序时,您会发现应用程序委托非常有用。
The tutorial is old, but to answer your question, the App Delegate is an NSObject that implements the NSApplicationDelegate protocol. More infor here.
You don't necessary need to do anything with this class with respect to your tutorial. As you write more advanced programs you will find that the application delegate can be very useful.