0

I'm trying to make an application for managing and opening PDF files. It's document based. In my UI designer I've got an NSSplitView with an NSTableView on the left and a PDFView (from PDF Kit) on the right.

I have a controller class for my NSTableView which adds a row for each PDF file in the current dir, and a controller class for my PDFView with methods for loading PDF data. They both have outlets connected to their respective objects.

What I'm not sure of is how all these controllers are supposed to interact. I've tried instantiating objects in the windowControllerDidLoadNib method of my Document class like so:

tableViewController = [[TableViewController alloc] init];
pdfViewController = [[PDFViewerController alloc] init];

And then loading in PDF files in the readFromData method like so:

[pdfViewController loadPDFFromData: data];

But it doesn't seem to do anything at all.

I suspect I'm not working on the right PDFViewerController object but I'm not sure how to access the one that's there... Eventually the goal is to have the PDF file referenced by the selected row in the NSTableView loaded into the PDFView but I have no idea how these objects should interact. What should be the glue that holds all this together?

Pancakes
  • 149
  • 2
  • 7

1 Answers1

0

I am not certain the benefit of using NSDocument here. As far as the "glue code", you can have the Window Controller handle the interaction. When you select an item from the table view, then you will load that file on the PDF view. If you are comfortable with bindings, you can also achieve the same with array controllers. Hope that helps.