记录方法用法的objective-c语法是什么?这是在.h或.m文件中完成的吗?
在C#中,使用类似于:
/// <summary>
/// Executes an HTTP GET command and retrieves the information.
/// </summary>
/// <param name="url">The URL to perform the GET operation</param>
/// <param name="userName">The username to use with the request</param>
/// <param name="password">The password to use with the request</param>
/// <returns>The response of the request, or null if we got 404 or nothing.</returns>
protected string ExecuteGetCommand(string url, string userName, string password) {
...
}
Run Code Online (Sandbox Code Playgroud)
这是用#pragma指令完成的吗?
谢谢,
克雷格布坎南
Chr*_*ahl 20
Xcode 5中有一项新功能可以记录您的方法.在头文件中,您可以向函数添加注释,以便将它们显示在文档中:
/*! Executes an HTTP GET command and retrieves the information.
* \param url The URL to perform the GET operation
* \param userName The username to use with the request
* \param password The password to use with the request
* \returns The response of the request, or null if we got 404 or nothing
*/
- (NSString *)executeGetCommandWithURL:(NSURL *)url userName:(NSString *)aUserName andPassword:(NSString *)aPassword;
Run Code Online (Sandbox Code Playgroud)
注意第一行的感叹号.
此文档将显示在Xcode右侧窗格的"快速帮助"中,当您键入时,描述将显示在功能自动完成中.
Objective-C 没有内置的文档功能。Apple 提供了一个名为 Headerdoc 的工具,可以从源文件生成文档,但还有几个更好的选择。我认为最流行的是Doxygen,在这种情况下,语法是 Java 风格的/** Documentation here */。您可以查看维基百科页面以获取如何使用它的示例(尽管使用其他语言)。Apple 在其网站上提供了将 Doxygen 与 Xcode 结合使用的说明。
| 归档时间: |
|
| 查看次数: |
4029 次 |
| 最近记录: |