ios - 使用CGImageMetadataSetTagWithPath设置exif的用户评论字段的路径是什么?
<p><p>使用CGImageMetadataSetTagWithPath设置exif的用户评论字段的路径是什么?</p>
<p> <a href="https://developer.apple.com/documentation/imageio/1465409-cgimagemetadatasettagwithpath" rel="noreferrer noopener nofollow">https://developer.apple.com/documentation/imageio/1465409-cgimagemetadatasettagwithpath</a> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>它适用于 <code>exif:UserComment</code>:</p>
<pre><code>guard let tag = CGImageMetadataTagCreate(
kCGImageMetadataNamespaceExif,
kCGImageMetadataPrefixExif,
kCGImagePropertyExifUserComment,
.string,
"my exif comment" as CFString) else { fatalError("Metadata tag not created") }
let metadata = CGImageMetadataCreateMutable()
CGImageMetadataSetTagWithPath(
metadata,
nil,
"exif:UserComment" as CFString,
tag)
</code></pre>
<hr/>
<p><strong>编辑</strong></p>
<p>在撰写本文时,如果想要 ImageIO 函数的文档,则应 Cmd 并单击其中的每一个函数。它的格式似乎没有更新,因此没有显示在 Xcode 或其网络界面 (developer.apple.com) 中。</p>
<p>我们在 <code>CGImageMetadataCopyTagWithPath</code> 函数的文档中提供了有关如何形成路径的更多信息。摘录:</p>
<blockquote>
<p>A string representing a path to the desired tag. Paths consist of a tag prefix (i.e. "exif") joined with a tag name (i.e. "Flash") by a colon (":"), such as CFSTR("exif:Flash").</p>
</blockquote>
<p>我们可以使用以下代码来代替对值进行硬编码:</p>
<pre><code>let path = "\(kCGImageMetadataPrefixExif):\(kCGImagePropertyExifUserComment)" as CFString
</code></pre></p>
<p style="font-size: 20px;">关于ios - 使用CGImageMetadataSetTagWithPath设置exif的用户评论字段的路径是什么?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/44835500/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/44835500/
</a>
</p>
页:
[1]