I want to add a simple one-page HTML page help to my Cocoa app. Can you tell me how to do it? I assume I just have to throw in one lousy .html (and maybe one .css?) file somewhere into my Cocoa project in Xcode?
Creating Apple Help documents that are opened in the Help viewer is straightforward but you must follow the directions in the documentation exactly.
Help files are HTML but you need to place a couple of special tags in the page and name the files in a particular way.
It's all explained in the documentation.
If you only want a single HTML page and not a proper help file, you could add an HTML document and CSS file to your project. These will be copied to your application's Resources
directory inside the app bundle when you compile the project. To load the document, you'll need to get its address. This is actually quite easy:
NSString *helpFilePath = [[NSBundle mainBundle] pathForResource:@"YourHelpDocumentHere" ofType:@"html"];
NSURL *helpFileURL = [NSURL fileURLWithPath:helpFilePath];
The resulting URL will be a file URL that a WebView
can display inside your application, or you can pass it off to the operating system using NSWorkspace
and it will be opened in the user's default web browser.