Re: Triggering a segue from code
Re: Triggering a segue from code
- Subject: Re: Triggering a segue from code
- From: Kyle Sluder <email@hidden>
- Date: Thu, 22 Sep 2016 22:17:02 -0500
On Thu, Sep 22, 2016, at 02:47 PM, Quincey Morris wrote:
> On Sep 22, 2016, at 12:34 , Kyle Sluder <email@hidden> wrote:
> >
> > -close asks the window’s delegate (via -windowShouldClose:) if it should
> > close. If the window is owned by a window controller that’s associated
> > with a document, the document will also get a chance to weigh in via
> > -shouldCloseWindowController:…. It will also send
> > NSWindowWillCloseNotification.
> >
> > -orderOut: just hides the window (removes it from the window list). You
> > can always order it back in again later.
>
> Yes, but ignore for a moment the “shouldClose…” interaction, and assume
> the window is NOT set to release on close. What *else* does “close” do
> vs. “orderOut”?
This question sounds vaguely similar to “What have the Romans done for
us?” from Life of Brian. ;-)
>
> The example app mentioned in this thread demonstrates that “close” has
> some other effect beyond what “orderOut” does. In particular, a
> “single”-mode storyboard segue re-uses an ordered-out window, but not a
> closed one.
I must first admit, especially for the benefit of anyone who read the
documentation after I replied to you, that I was mistaken.
-shouldCloseWindowController: and -windowShouldClose: are only sent from
-performClose:, not from -close. Which makes sense: -close is the
unconditional way for an app (that might have even implemented its own
confirmation flow) to close a window.
Having made my apologies, -orderOut: and -close live at two levels of
abstraction. -orderOut deals with the window’s order and membership in
the window list. -close deals with higher-level semantics like window
controllers, documents, and notifications. As part of these higher-level
semantics, -close calls -orderOut:. For document-based apps, it also
dissociates the window from the document (and the window controller the
document made for it). And as Eric has discovered, it instructs the
Storyboard runtime to create a new instance of the window controller
rather than unhiding the existing one.
(-close used to render windows more thoroughly dead in the era of
releaseWhenClosed and one-shot backing stores. But those days are in the
past.)
--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