问题描述
使用以下代码突出显示 pdf 中的搜索文本字符串。
let selections = pdfView?.document?.findString(searchTerms!,withOptions: [.caseInsensitive])
selections?.forEach { selection in
selection.pages.forEach { page in
let highlight = PDFAnnotation(bounds: selection.bounds(for: page),forType: .highlight,withProperties: nil)
highlight.endLineStyle = .square
highlight.color = #colorLiteral(red: 0.9843137255,green: 0.9019607843,blue: 0.5529411765,alpha: 1)
page.addAnnotation(highlight)
}
}
它非常适合小型 pdf。但是当有大约 2000 个或更多页面时,应用程序会冻结。 选择需要一些时间。有没有办法来解决这个问题。也尝试使用 beginDocumentFind 委托。相同的结果
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)