Re: Is there a way to access other controller square's other icons programmatically?
Re: Is there a way to access other controller square's other icons programmatically?
- Subject: Re: Is there a way to access other controller square's other icons programmatically?
- From: Quincey Morris <email@hidden>
- Date: Mon, 27 Mar 2017 13:43:58 -0700
On Mar 27, 2017, at 12:50 , Daryle Walker <email@hidden> wrote:
>
> So, there is no API to getting at runtime the top-bar items that you add?! (If you don’t mind a subclass, you can drag items from the storyboard to the corresponding subclass definition file.)
AFAIK, there is no API for this, starting from the view controller object. If you instantiate the NIB yourself (the view controller from the storyboard is compiled into some NIB or other), you can get an array of the top level objects when the NIB loads, but I don’t see how that helps when you’re using storyboards.
> I was trying to avoid using subclasses.
On iOS, business logic typically goes in the view controller, so it’s common to subclass. (Exceptions would be when you use a specific kind of view controller, such as a table view controller.) That goes hand in hand with the storyboard metaphor, when the scenes (object graphs with a view controller at their root) don’t have data cross-connections made in IB.
So, I think you have to buy into a fairly similar pattern for storyboards on macOS. NSViewController was enhanced to support this, and (minimally) subclassing is *how* you get access to custom NIB objects.
If you don’t want to follow this pattern, then I think a better solution is to use XIBs rather than storyboards, which is still perfectly feasible. In a sense, by choosing a storyboard, you are choosing to partition your UI into unconnectable pieces.
_______________________________________________
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