Re: Re : Re: Saving while opening with NSDocument
Re: Re : Re: Saving while opening with NSDocument
- Subject: Re: Re : Re: Saving while opening with NSDocument
- From: Kyle Sluder <email@hidden>
- Date: Mon, 24 Mar 2014 10:55:13 -0700
On Mar 24, 2014, at 10:05 AM, Colas B <email@hidden> wrote:
>
> Finally, I put the "saveDocument" in the "NIBDidLoad" method, with an "afterDelay:0". I was reluctant to use this "afterDelay:0" (I wish there were a method called "performOnNextRunLoop"). This smells like a hack !!!
> It was easier to call the "saveDocument" than to subclass NSDocumentController, and result is safer I think. I don't have to deal with the case where no nib is loaded.
>
> It works well.
Please heed my advice about not using -windowControllerDidLoadNib. Put it somewhere else. In addition to breaking if you ever decide to start overriding -makeWindowControllers (which in my experience all but the most trivial apps wind up doing), this can cause serious problems if the user ever chooses File > Revert.
The correct thing to do often appears harder than it should be because much of the difficulty of doing it the right way comes from not understanding the architecture.
--Kyle Sluder
_______________________________________________
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