Thank you for your reply Quincey. I am definitely getting closer to the
behavior I want.
Performing the “Show Inspector” segue from the my custom document window
controller (WindowController.swift) allows both by regular button and toolbar
button to show the Inspector.
As you suggested, I also created a custom window controller for my inspector
(InspectorWindowController.swift). It looks like:
class InspectorWindowController: NSWindowController
static var sharedInstance: NSWindow? = nil
override func windowDidLoad()
InspectorWindowController.sharedInstance = self.window
This does allow my hide panel action function to hide the panel by doing:
@IBAction func hideMyPanel( _ sender: AnyObject )
InspectorWindowController.sharedInstance?.performClose( self )
The strange behavior I am now seeing is that when I show & hide the panel using
the buttons are what appears to be two (not three, not four, etc.) different
instances of the inspector panel. The autosave information only appears to
apply to one but not the other.
I have updated the project which should replicate this behavior.
If you or anyone else has any ideas on how I can get the correct behavior for
showing and hiding the inspector NSPanel, I would be interested.
> On Sep 18, 2016, at 4:32 PM, Quincey Morris
> <quinceymor...@rivergatesoftware.com> wrote:
> On Sep 18, 2016, at 12:22 , mail...@ericgorr.net
> <mailto:mail...@ericgorr.net> wrote:
>> While I do see the log message 'How do I..', my utility panel is not shown.
>> How can I get this work?
> Most of the problem is that storyboards and segues for the Mac are
> inadequately documented. This is exacerbated by the fact that understanding
> the behavior “by analogy with iOS” breaks down when windows are involved,
> since there’s no such thing (AFAIK) as a segue between windows on iOS.
> By trial and error, I discovered that the problem in your sample project is
> that a “show” segue from a view controller does not open a new window. This
> halfway makes sense, although the fact that it does nothing and produces no
> exception or log message is pretty unhelpful. (Bug report!)
> To get the button to display the panel, you need to have the window
> controller perform the segue. That means you’ll need a custom window
> controller subclass for the main window, and you can just move the action
> method into the window controller. (Hook the button up to First Responder
> instead of the view controller, too.)
> Alternatively, go back to using a segue from the button to open the panel,
> which IIRC was working in an earlier version of this test project. (You
> posted that it wasn’t working, but when I went to look at your project you’d
> already fixed the problem in your project that was preventing it from
> working. IIRC.)
> To do all the combinations of hiding and showing a singleton panel, you’ll
> probably want another custom window controller subclass for the panel itself.
> Not every window/window controller operation seems to be mapped into
> storyboard semantics, so you should expect that there are things that still
> need to be done “the old way”.
Cocoa-dev mailing list (Cocoafirstname.lastname@example.org)
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 arch...@mail-archive.com