I have a little question, I try to understand how to save a file with Cocoa for a Mac application, I understand that I can save it with a Save Panel.
Here is a great example: Saving files in cocoa
Now my question is, is there a way to save the document (a plst file) with a my extension (eg. *.fun, *.xxx, *.myextension, ecc...)? I want to be able to open my application when the user double clicks on the file.
Set the accepted document types in your application's plist; something like this:
Make "yourExtension" whatever you want your extension to be without the period.
But once you've done that, it's up to you to figure out how to load them upon opening. That's where NSDocument and friends come in. Look into how a document-based application functions. Here's some Apple documentation on the subject.
If you want to see it in action check the source for TextEdit in /Developer/Examples. Plus, if you don't mind migrating the progress you have, Xcode has a template for a document-based application (Create a new project and select the checkbox titled "Create Document Based Application".)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With