Instance Method インスタンスメソッド

presentedItemDidChange()

Tells your object that the presented item’s contents or attributes changed. 提示された項目のもつ内容または属性が変更されたことを、あなたのオブジェクトに伝えます。

Declaration 宣言

optional func presentedItemDidChange()

Discussion 議論

You can use this method to update your internal data structures to reflect the changes to the presented item. This method reports both changes to the file’s contents, such as the data in a file or the files in a directory, or the attributes of the item, such as whether the Hide extension checkbox of a file was toggled. あなたは、このメソッドを使ってあなたの内部データ構造体を更新してその提示された項目への変更を反映できます。このメソッドは、ファイルの内容に対する変更、例えばディレクトリの中のあるファイルまたは複数のファイルの中のデータなど、または項目の属性、例えばあるファイルの「拡張子を隠す」チェックボックスがオンオフされるかどうかなどの両方を報告します。

Because this method notifies you of both attribute and content changes, you might want to check the modification date before needlessly rereading the contents of a file. To do that, you must store the date when your object last made changes to the file and compare that date with the item’s current modification date. Use the coordinate(readingItemAt:options:error:byAccessor:) method of a file coordinator to ensure exclusive access to the file when reading the current modification date. このメソッドはあなたに属性および内容の変更の両方を通知することから、あなたはあるファイルの内容を無駄に再読み出す前に修正日を確認したいかもしれません。それをするために、あなたは、あなたのオブジェクトが最後にファイルを変更した時に日付を格納して、その日付をその項目の現在の修正日と比較しなければなりません。ファイルコーディネータのcoordinate(readingItemAt:options:error:byAccessor:)メソッドを使って、現在の修正日を読み出す時にファイルへの排他的なアクセスを確実にしてください。

See Also 参照

Handling Changes to Files ファイルへの変更を取り扱う