本文介绍了如何使用文档来装饰Objective C方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开一个Cocoa对象并在该对象上调用一个选择器时,我有时可以看到关于该方法的文档或帮助信息。例如,当我键入 [NSArray alloc] 时,我看到两个帮助提示。一个用于 NSArray ,另一个用于 alloc 。当我输入代码时,这两个都会显示在弹出式自动填充建议列表框中。



如何生成类似的方法/类装饰的帮助提示,当我输入时会显示?当我输入我的自定义类名和自定义方法时,我想看到我的评论。如何做到这一点?



例如,C#通过可以在任何方法,类或接口/协议声明之前放置的XML文档来提供此功能。 >

解决方案

你必须创建一个docset。 有用于从您的评论中创建文档的工具。你可以设置一个在你的代码上运行appledoc的构建阶段。



问题是没有办法使Xcode 4重新加载文件集,除非重新启动Xcode。因此,即使您在构建中自动运行appledoc,您将不得不重新启动Xcode,以使其看到您的文档集的更改。


When I'm typing up a Cocoa object and calling a selector on that object, I sometimes can see 'documentation' or 'help' information about that method. For instance, as I type [NSArray alloc], I see two help hints. One for NSArray, and one for alloc. Both of these appear in the popup autocomplete suggestions listbox as I type the code.

How do I produce similar method/class decorated help hints which will appear when I type? I want to see my comments as I type my custom class name and custom methods. How can I do this?

For instance, C# provides this feature through XML documentation which can be placed before any method, class, or interface/protocol declaration.

解决方案

You have to create a "docset". There are tools like appledoc for creating docsets from your comments. You could set up a build phase that runs appledoc on your code.

The problem is that there's no way to make Xcode 4 reload a docset except by restarting Xcode. So even if you run appledoc automatically as part of your build, you will have to restart Xcode to make it see the changes to your docset.

这篇关于如何使用文档来装饰Objective C方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 01:13