Using NSSavePanel, how can a user select a specific type of file to save?

I am writing an application in Cocoa that allows a user to export data in three different formats: CSV, JSON, and XML. I added the allowed extensions for the NSSavePanel:

NSSavePanel* saveFile = [NSSavePanel savePanel];
NSArray* extensions = [[NSArray alloc] initWithObjects:@"csv", @"json" @"xml", nil];
[saveFile setAllowedFileTypes:extensions];

However, how can I configure NSSavePanel so that the user can choose which format to save, for example, in TextEdit, where the "File format" list is offered? If possible, how can I determine which format was selected?

+5
source share
1 answer

NSView NSSavePanel setAccessoryView:, . Apple docs. Apple Custom Save. .

+5

All Articles