Guides and Sample Code

Developer

Playground Book Format Reference

On This Page

Hints Property List
ヒントプロパティリスト

The optional hints property list contains an array of dictionaries with information about each hint. The property list file is called Hints.plist and is located in the PrivateResources folder of a page at the following path:
任意のヒントプロパティリストは、各ヒントについての情報を持つディクショナリからなるある配列を含みます。そのプロパティリストはHints.plistと呼ばれ、以下のバスでのページのPrivateResourcesフォルダに位置します:

<book name>.playgroundbook/Contents/<chapter name>.playgroundchapter/Pages/<page name>.playgroundpage/PrivateResources/Hints.plist

You can localize hints by enclosing the hints property list file in a localization folder within the PrivateResources folder.
あなたは、ヒントプロパティリストファイルをPrivateResourcesフォルダ内のローカライズフォルダの中に納めることによってヒントをローカライズできます。

Adding a Hints.plist file to a page adds a Hint button to the page. A page may have one or more hints. Each hint displays either text in the property list or the contents of a referenced file key. A hint may optionally have a spoiler button, which causes the content of the hint to be hidden until the spoiler button is tapped.
Hints.plistファイルをページに加えることは、Hintボタンをそのページに加えます。ページは、ひとつ以上のヒントを持てます。各ヒントは、プロパティリストの中のテキストか、参照されたファイルキーの内容のどちらかを表示します。ヒントは、随意にスポイラーボタンを持てます、それはヒントの内容がスポイラーボタンがタップされるまで隠されるようにします。

Listing 16-1 shows an example Hints property list.
コード出力 16-1 は、例のHintsプロパティリストを示します。

Listing 16-1Example Hints.plist file
コード出力 16-1 例 Hints.plist ファイル
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4. <dict>
  5. <key>Hints</key>
  6. <array>
  7. <dict>
  8. <key>Content</key>
  9. <string>This is an inline hint.</string>
  10. </dict>
  11. <dict>
  12. <key>Content</key>
  13. <string>This is an inline hint with a spoiler button.</string>
  14. <key>SpoilerButtonTitle</key>
  15. <string>Show Spoiler</string>
  16. </dict>
  17. <dict>
  18. <key>FileReference</key>
  19. <string>OutOfBandHint.txt</string>
  20. </dict>
  21. <dict>
  22. <key>FileReference</key>
  23. <string>OutOfBandHintWithSpoilerButton.txt</string>
  24. <key>SpoilerButtonTitle</key>
  25. <string>Show Spoiler</string>
  26. </dict>
  27. </array>
  28. </dict>
  29. </plist>

Hints are shown in a popover, in the same order in which they occur in the array. Each hint is represented by a dictionary in the array. Hints are formatted using markup, and no special comment delimiters are required. For more information on markup, see Markup Formatting Reference.
ヒントはポップオーバーにおいて、それらが配列に現れるのと同じ順序で、表示されます。各ヒントは、配列の中の1つのディクショナリによって表されます。ヒントはマークアップを使って書式設定され、特別なコメント区切り記号は必要とされません。マークアップに関するさらなる情報として、Markup Formatting Referenceを見てください。

Key List
キーのリスト

A hint dictionary specifies the text for a hint and an optional spoiler button title.
ヒントディクショナリは、ヒントのためのテキストおよび任意のスポイラーボタンタイトルを指定します。 Each hint dictionary must specify either a Content Key
キー
or a FileReference Key, as shown in Table 16-1.

Table 16-1Keys for a hint dictionary

Key

Type

Description
説明

Content

String

The formatted text for the hint shown in the popover. See Content Key.
ポップオーバーにおいて現れるヒントのための書式設定されたテキスト。Contentキーを見てください。

FileReference

String

A file in the Resources folder of the page that contains the formatted text for the hint. See FileReference Key.
そのページのResourcesフォルダの中のあるファイルで、ヒントのための書式指定されたテキストを含みます。FileReferenceキーを見てください。

SpoilerButtonTitle

String

The title for a spoiler button. See SpoilerButtonTitle Key.
スポイラーボタンのタイトル。SpoilerButtonTitleキーを見てください。

Content Key
Contentキー

The text for the hint shown in the popover. A hint dictionary with a Content key can't also contain a FileReference key.
ポップオーバーにおいて表示されるヒントのためのテキスト。Contentキーを持つヒントディクショナリは、さらにまたFileReferenceキーを含むことはできません。

FileReference Key
FileReferenceキー

The file path for a text file in the Resources folder that contains the hint text shown in the popover. The text is formatted using markup, and no special comment delimiters are required. A hint dictionary with a FileReference key can't also contain a Content key. The file path is relative to the Resources folder of the page.
Resourcesフォルダの中のあるファイルに対するファイルパスで、ポップオーバーにおいて表示されるヒントテキストを含みます。テキストはマークアップを使って書式設定され、特別なコメント区切り記号は必要とされません。FileReferenceキーを持つヒントディクショナリは、さらにまたContentキーを含むことはできません。ファイルパスはページのResourcesフォルダに相対的です。

SpoilerButtonTitle Key
SpoilerButtonTitleキー

The title for a spoiler button. Including this key shows a spoiler button with the specified title in the popover instead of the hint. Touching the spoiler button displays the hint. Any hint can have a spoiler button.
スポイラーボタンのタイトル。このキーを含むことで、ヒントではなくポップオーバーにおいて指定されたタイトルを持つスポイラーボタンが現れます。スポイラーボタンにタッチするとヒントが表示されます。どんなヒントもスポイラーボタンを持つことができます。