Cocoa App帮助书的目录(侧栏) [英] Table Of Contents(Side Bar) for Cocoa App's Help Book

查看:97
本文介绍了Cocoa App帮助书的目录(侧栏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的应用程序构建帮助书,主要是使用Apple的文档

I'm in the process of building a help book for my application, mainly using apple's documentation here, however it appears to be a little dated. In Yosemite OS X 10.10, apple's own apps have a collapsable side bar that displays the table of contents for the help bundle

尽管在我自己的应用程序中有侧栏按钮,但我不知道如何访问它.有人知道如何访问此侧边栏吗?并为我们自己的应用程序提供内容?

Although, the side bar button is present on my own app I have no idea how to access it. Does anyone know how to access this sidebar? and provide content for our own apps?

推荐答案

我刚刚遇到了同样的问题,因此我不得不在Apple Mail的帮助文件中进行挖掘,以了解它们的用途.基本上,他们已经在HTML/CSS中构建了侧边栏,并且它不是帮助查看器的一部分.

I've just come up against the same problem, and I had to dig around in Apple Mail's help files to find out what they were using. Basically they have constructed their sidebar in HTML/CSS, and its not a part of the help viewer.

要在帮助查看器中启用目录"按钮,您需要使用javascript函数:

To enable the "Table of Contents" button in the help viewer, you need to use the javascript function:

window.HelpViewer.showTOCButton(bool, function, function);

对于更明确的示例,以下代码段将启用Apple帮助查看器中的目录"按钮,并将其链接到功能"toggleNavigation".

For a more explicit example, the following code snippet will enable the "Table of Contents" button in Apple's help viewer, and link it to the function "toggleNavigation".

if ("HelpViewer" in window && "showTOCButton" in window.HelpViewer) {

    window.setTimeout(function () {
        window.HelpViewer.showTOCButton(true, toggleNavigation, toggleNavigation);
        window.HelpViewer.setTOCButton(true);
    }, 100);
}

toggleNavigation函数将包含用于打开侧边栏的代码.

The toggleNavigation function will contain code to open your sidebar.

function toggleNavigation() {
    // YOUR CODE HERE
}

我发现使用window.onload似乎不起作用,但是将超时设置为100ms是可行的.按照示例,在Mail中,Apple对两个函数参数都使用了等效的"toggleNavigation"函数.当您按下目录"按钮时,将调用第三个参数,但是我还没有弄清楚第二个参数的作用.

I found that using window.onload doesn't seem to work, but setting a timeout for 100ms did. In Mail, Apple used their equivalent of the "toggleNavigation" function, for both of the function parameters, as per the example. The third parameter is called when you press the "Table of Contents" button, but I've not worked out what the second one is for.

这篇关于Cocoa App帮助书的目录(侧栏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆