Reputation: 733
I have a document-based application that is designed to process existing documents, not to create new documents.
How do I prevent the application from creating a new, blank document when launched by opening it from the Finder?
Upvotes: 2
Views: 725
Reputation: 969
Depending on what you are specifically doing, you might want to override newDocument: or applicationOpenUntitledFile: or otherwise stop the user from invoking it via the File->New menu.
However, the answer above, using the delegate method applicationShouldOpenUntitledFile: will handle the common situations where you'd need that behavior.
Upvotes: 1
Reputation: 150765
There is an NSApplication delegate protocol method you can implement.
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender {
return NO;
}
Here's the documentation
Upvotes: 9