- simple line annotation:
///simple annotation
or:
/*! single line annotation. */
2.multiple annotation:
/** simple annotation
* multiple annotation
*/
or:
/** @brief simple annotation
* multiple annotation
*/
3.Delegate && category annotation:
In a delegate or category file,We can use simple line annotation.we can use multiple annotation too, of course.
4.property annotation:
As the same, we can use both single line annotation and multiple annotation.
5.methods annotation:
if the method has no argument,we can use single line annotation.
if the method has argument,we have to write like this:
/**
* @brief the method has two arguments.
* @param value This is the first argument.
* @param value2 This is the second argument.
* @return This is a return value.
*/
- (id)getSomeElementWithArgument:(id)value andArgument:(id)value2.
ps.
@param<name><description>: the description of argument.
@return<description>: the description of return value.
6.A complex annotation:
/**
* @brief description
*
* @param value description.
*
* @return return value description.
*
* @exception NSException exception description.
*
* @see someMethod.
* @warning warning:warning information
* @bug bug:bug information.
*/
- (NSString *)someMethondByStr:(NSString *)value
ps.
@exception <name> <description>: description.
@warning <text>: warning description.
@bug <text>: bug description.
@see <name>
Methods or properties in the Class or Delegate.
7.if we have to write some code paragraph in annotation,we can use ` to include the paragraph.
8.creat list in annotations.
a. disordered list:
use "-","+"or"*"character before annotation.
/**
* disordered list:
*
* - abc
* - xyz
* - rgb
*/
b. ordered list:
use number or decimal point before annotation.
/**
* ordered list:
*
* 1. first
* 2. second
* 3. third
* 4. forth
*/
c. blank: example
/**
* | Kxx | xxxx | xxQ |
* |-----|:----:|----:|
* |norma|center|right|
* |cell |cell |cell |
*/
this will be a blank like this:
9.include a link:
write the link words directly.
/**
* http://github.com/Asahi_Kuang
*/