加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Objective-C方法描述(doc评论)

发布时间:2020-12-15 01:54:46 所属栏目:百科 来源:网络整理
导读:我正在学习Objective-C,需要知道如何编写方法描述。我在Objective-C中学习如何做到这一点很困难。 在耶夫我们有这个 /** h2 MethodName/ h2 p Various Description,can use html with images etc./ p */private void methodName(args[]..){} 在目标c中,我
我正在学习Objective-C,需要知道如何编写方法描述。我在Objective-C中学习如何做到这一点很困难。

在耶夫我们有这个

/**
< h2 >MethodName</ h2 >
< p >Various Description,can use html with images etc.</ p >
*/
private void methodName(args[]..)
{

}

在目标c中,我在哪里放置说明?这也是在头文件或实现文件中?

//Within Implementation?
- (float)gteHeightPercentage:(float)percentageToGet
{
    return self.view.bounds.size.height * percentageToGet;
}

//Within Header?
- (float)getWidthPercentage:(float)percentageToGet;

解决方法

更新:以下格式适用于Objc。如果要记录swift代码,请参阅 NSHipster’s blog about Swift Documentation

XCode 5可以做你想要的感谢Wonil Kim,在.h文件中:

/** 
 * Add new message between source to destination timeline as empty name string
 * @author Wonil Kim
 *
 * @param sourceId Source timeline entity ID
 * @param destId Destination timeline entity ID
 * @return A newly created message instance
 */
- (ISMessage*)messageFromTimeline:(NSInteger)sourceId toTimeline:(NSInteger)destId;

一旦完成,你可以选择点击方法名称,和..violà!

当然,从Kim’s blog可以看出,这不是唯一的办法:

/*! Some description of the method....
 * returns  The result
 */

或者,

/// Some description to show up,done by:
/// @author  Olly Dixon

你得到了点…

正如许多已经提到的那样,Objective-C不会向您显示您的文档;其实也不是java(javadoc,可能是)。这是你的IDE,在这种情况下,不可崩溃的Xcode

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读