Re: converting app to a document based app
Re: converting app to a document based app
- Subject: Re: converting app to a document based app
- From: Quincey Morris <email@hidden>
- Date: Tue, 15 Feb 2011 11:08:21 -0800
On Feb 15, 2011, at 07:30, Nick Rogers wrote:
> Hi,
> Googled a lot but didn't find anything.
> Can some one send definitive steps for converting a non-document based app to a document based app.
1. Create a new project using the document-based app template.
2. Move the code you need from the old project to the new project.
:)
Seriously, I'd suggest you're better starting over with a new project, rather than trying to retrofit document behavior to your existing one. (It's not so hard conceptually, but it's too easy to leave stuff out that you don't have to think about when starting from the template.)
When moving the code, the basic idea is that much of what's in your AppController class gets moved into your document subclass or your document window controller subclass. Only behavior that applies to the application as a whole gets left behind.
> In my app, there is a MainMenu.nib and an AppController class.
> I'd also want to convert the nib to a xib.
Again, I think you're better off recreating your UI in the MainMenu.xib and MyDocument.xib files that the template gives you. The main menu xib has preset internal wiring for some menu items, and it's safer just to delete what you don't want and add only what's really different from the template. For the document xib, you could delete the default window and paste in the window from your old nib, but I still think it's safer to completely recreate that file too. A couple of hours of grunt work in IB isn't so bad if the alternative is a couple of hours of debugging to find some subtly mis-configured piece.
(If you have an existing window nib that you really want to reuse, you can open it in IB and re-save it as a xib file. The only essential change would be to change File's Owner to your document subclass OR your document window controller class.)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden