Re: Triggering a segue from code
Re: Triggering a segue from code
- Subject: Re: Triggering a segue from code
- From: Quincey Morris <email@hidden>
- Date: Sun, 25 Sep 2016 12:52:26 -0700
- Feedback-id: 167118m:167118agrif8a:167118sTzTUUHNlm:SMTPCORP
On Sep 25, 2016, at 11:59 , email@hidden wrote:
>
> 2. The reason why I do a performClose is because I want it to do the same thing as when the user presses the close button on the panel, which they are allowed to do. Unless I were to remove the close button from the inspector panel (which I do not want to do), my overall problem remains.
There are a couple of different approaches you can take:
1. You know now that if you performClose or close the panel, a storyboard segue is going to create a new instance. You can deal with that by keeping enough panel state outside the panel view controller to re-configure a new panel if it’s created. That is, you don’t need the existence of the panel to be continuous. All you need is one panel at a time.
2. Don’t use segues for this. Move the panel to its own storyboard or XIB file. (Instantiate the storyboard in code, or load the NIB via the view controller initWithNibName initializer.)
3. Don’t do the performClose behavior. The point of the button-highlighting behavior is to indicate the window being affected when the user does something non-specific like choosing File -> Close or typing Command-W. Neither of those (presumably) will affect your inspector panel — otherwise it’d be too confusing for the user, whether a document window or the inspector was going to be closed.
If the user has to click a button (e.g. toolbar or regular window button) to hide the inspector, the animated interaction *is* that button’s down/up transition, so there’s no need for it in the panel’s title bar.
4. You could, I suppose, subclass NSPanel and override the “close” method. The documentation says that “performClose” invokes “close”. You should be able to have the “close” override do an “orderOut:” instead.
_______________________________________________
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