2009-07-07 36 views
6

記錄方法使用情況的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) { 
... 
} 

這是與#pragma指令做了什麼?

感謝,

克雷格·布坎南

回答

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; 

注意感嘆號:在你的頭文件,你可以像這樣註釋添加到您的功能,使它們在文檔中出現。

此文檔將顯示在Xcode右窗格的快速幫助中,當您鍵入時,說明會在功能自動完成中顯示。

+4

`/ **`似乎也工作 – davis 2014-10-24 02:26:53