一直感觉注释很重要,所以把注释的一些规范总结一下,对后期维护真是非常的重要。
1.先写一下个个字段对应的意思
/*!
@header 文件名
@abstract 简介,概念
@discussion 用途,方法
@copyright 版权
*/
给出一个模版
/*!
@header MFMailComposeViewController
@abstract The MFMailComposeViewController class provides an interface for editing and sending email.
@discussion MFMailComposeViewController is used for implementing a simple interface for users to enter
and send email.
@copyright Copyright 2008, 2009 Apple Inc. All rights reserved.
*/
2.第二种注释,用于介绍枚举类型/*!
@enum MFMailComposeResult
@abstract Composition result sent to the delegate upon user completion.
@discussion This result will inform of the user's choice in regards to email composition. If the user
cancels the composition, <tt>MFMailComposeResultCancelled</tt> will be sent to the delegate.
Typically <tt>MFMailComposeResultSent</tt> or <tt>MFMailComposeResultSaved</tt> will
be sent, but <tt>MFMailComposeResultFailed</tt> will be sent in the case of failure.
</p>Send may only be interpreted as a successful queueing of the message for later sending.
The actual send will occur when the device is able to send.
@constant MFMailComposeResultCancelled User canceled the composition.
@constant MFMailComposeResultSaved User successfully saved the message.
@constant MFMailComposeResultSent User successfully sent/queued the message.
@constant MFMailComposeResultFailed User's attempt to save or send was unsuccessful.
*/
enum MFMailComposeResult {
MFMailComposeResultCancelled,
MFMailComposeResultSaved,
MFMailComposeResultSent,
MFMailComposeResultFailed
};
typedef enum MFMailComposeResult MFMailComposeResult;
3.不可改变量的注释/*!
@const MFMailComposeErrorDomain
@abstract Error domain for NSError values stemming from the MFMailCompose API.
@discussion This error domain is used as the domain for all NSError instances stemmming from the
MFMailCompose API. Valid error code values are declared in the <tt>MFMailComposeErrorCode</tt>
space.
*/
extern NSString *const MFMailComposeErrorDomain ;
4.一个类的注释/*!
@class MFMailComposeViewController
@abstract The MFMailComposeViewController class provides an interface for editing and sending email.
@discussion The MFMailComposeViewController class manages all user interaction. The client needs to set the recipient or
recipients. The client may also set the subject and the body of the message. Attachments may be added, if
so desired. After setup, the client needs to only display the view.</p>The provided delegate will be informed
of the user's composition completion and how they chose to complete the operation.<p>Prior to use, clients
should verify the user has set up the device for sending email via <tt>+[MFMailComposeViewController canSendMail]</tt>.
*/
@interface MFMailComposeViewController : UINavigationController
{
@private
id _internal;
}
5.一个方法的注释
/*!
@method setSubject:
@abstract This method sets the Subject header for the email message.
@discussion This method will set the Subject header for the email message. This should be called prior to display.
</p>After the view has been presented to the user, this method will no longer change the value.
@param subject A NSString specifying the message's Subject header.
*/
- (void)setSubject:(NSString *)subject;
6.一个属性的注释/*!
@property mailComposeDelegate
@abstract This property is the delegate for the MFMailComposeViewControllerDelegate method callbacks.
*/
@property(nonatomic,assign) id<MFMailComposeViewControllerDelegate> mailComposeDelegate /