Swift PDFKit添加注释到页面注释数组的开始?



在Swift PDFKit中是否有一种方法可以将注释添加到页面注释数组的开头。我想把我的注释添加到数组的开头因为它是一张图片我还想在它上面编辑其他注释

我能找到添加注释的唯一方法是使用以下代码,但它将其添加到数组的末尾,覆盖所有需要编辑的其他注释。

page.addAnnotation(myannotation)

谢谢你的帮助!

这是一个糟糕的解决方案,但它有效…

我做了一个tmp列表的所有注释,删除页面上的所有注释,然后把它们都添加回来,首先添加图像。

let list = page.annotations
for i in page.annotations{
page.removeAnnotation(i)
}
// add myannotation first
page.addAnnotation(myannotation)
// add other annotations back
for i in list {
page.addAnnotation(i)
}

最新更新