Xcode注释中的超链接

时间:2017-05-10 21:22:56

标签: xcode

我在代码的注释中添加了一个超链接,以供将来参考。通过从Safari复制URL然后将其粘贴到Xcode中来添加超链接。

问题在于,我现在无法控制超链接,因为它已粘贴到我的代码中,并且在添加其他文本时正在修改。

Example URL: https://link.to.resource/DID/
How I want the link to be displayed:  Device ID (listed in https://link.to.resource/DID/.)

如何在不修改链接位置的情况下添加其他文本?当我将./添加到结尾时,它将成为链接的一部分,地址将不再有效。

1 个答案:

答案 0 :(得分:1)

最简单的解决方案是在链接末尾包含空格或关闭位置。

您还可以使用注释标记添加指向Xcode快速帮助文档的链接。

/// Device ID (listed [here](https://link.to.resource/DID/))

这将创建一个如下所示的快速帮助说明:

A screenshot of the quick help description

如果您确实在链接末尾设置了句点,则可以将其添加到链接文本末尾的[]内。这就是Apple在其中一个链接标记示例中所做的事情。这会在结尾添加句点,但句点将被设置为链接文本的一部分。

/*:
  For more information, see [The Swift Programming Language.](http://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/)
 */

Apple的链接标记文档:https://developer.apple.com/library/content/documentation/Xcode/Reference/xcode_markup_formatting_ref/Links.html#//apple_ref/doc/uid/TP40016497-CH18-SW1

相关问题