I understand how to use an NSOpenPanel
to allow the user to select one or more existing files or directories, using a filename suffix. E.g.:
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
openPanel.canChooseFiles = YES;
openPanel.canChooseDirectories = NO;
openPanel.allowsMultipleSelection = NO;
openPanel.allowedFileTypes = @[@"sqlite3"];
However, I would like to know if there is a component that allows the user to select a new file. That is, they select a directory from the NSOpenPanel
and type in a filename. Is there a pre-built component for this?
Use the
NSSavePanel
component.https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSavePanel_Class/index.html.