Re: Using NSDocument with NSViewControllers
Re: Using NSDocument with NSViewControllers
- Subject: Re: Using NSDocument with NSViewControllers
- From: Ross Carter <email@hidden>
- Date: Thu, 23 Oct 2008 11:55:51 -0400
On Oct 23, 2008, at 3:07 AM, Paul Thomas wrote:
Before I set off down the road to frustrating deadendsville, has
anyone any experience with trying to coerce AppKit's document
architecture into a single window interface - i.e. using tabviews in
stead of separate windows?
A sneaky look at a couple of apps shows that people have usually
resorted to completely custom classes, but I'd like to use
NSDocument if possible - just with views instead of windows.
Is it possible?
I've done it, although my implementation is not yet bug-free. Smarter
developers might know an easier way, but for me it was a lot of work,
and I can't say that I saved any effort by working with NSDocument
instead of a custom class. FWIW, here are some of the methods I had to
override:
NSWindowController -document, -windowDidLoad, -windowWillClose:, -
windowDidResignMain:, -windowDidBecomeMain:, -windowDidResize:
NSDocumentController -openDocumentWithContentsOfURL:display:error:, -
openUntitledDocumentAndDisplay:error:, -
makeUntitledDocumentOfType:error:, -
reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSelector:contextInfo
:
NSDocument -
canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
The biggest problem was window closing behavior and making sure the
user gets prompted to save changes for each document in the window.
I didn't use NSViewController.
Ross
_______________________________________________
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