What is an acceptable way to implement export functions in a Cocoa document-based application?

I have a simple document-based Cocoa application that acts as a viewer for .wav files to analyze the frequency a bit. I would like to be able to export data obtained from open files to CSV for further analysis in other programs.

Cocoa's document-based application framework allows you to override

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError

to implement the default workflow Save / Save As ..., but I do not want to write the files that I open.

The obvious thing to do is implement the export workflow in my document, submit a file save sheet, create some NSData and write it to the file path, but there is no obvious way to connect the outlet in MainMenu nib to the action on the document controller.

So, what is an acceptable way to implement such functionality in a Cocoa document-based application?

+3
source share
1 answer

You can create a new action in MainMenu.nib's First Responder object, called export:, and connect to it. Then we implement the export: method in a subclass of the document. This will call your method.

, , , , - , . , , , , , .. , . ( , .)

Apple Response - 1.10 .

+3

Source: https://habr.com/ru/post/1706765/


All Articles