1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PDFKitで検索した時のDelegateの呼ばれ方

Posted at

はじめに

[PDFKit] (https://developer.apple.com/documentation/pdfkit)を使うと、iOSアプリで簡単にPDFビューアを作れるとういことなので、試してみました。このドキュメントでは、PDFKitの検索部分のDelegateについて書きます。

開発環境

  • Xcode: 11.2
  • iOS: 13.2

PDF検索とDelegate

PDFKitを使ったPDF内の検索は、同期型のfindStrings()と非同期型のbeginFindStringfindString()があります。検索時にいくつかのDelegateが呼ばれるようなので、どのような順番で呼ばれるか試してみました。検索に時間がかかる時など、非同期で処理を実施したい時には利用できそうです。

Delegateには、以下の3つの種類があります。

  • Document単位
  • Page単位
  • 検索文字列が見つかった場合

それぞれのDelegateの関係は図で書いた方がわかりやすいので、図を貼り付けておきます。

20191106-ios13-pdfkit-delegate.png

参考文献

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?