Re: instantiating nib objects conditionally
Re: instantiating nib objects conditionally
- Subject: Re: instantiating nib objects conditionally
- From: Jerome Krinock via Cocoa-dev <email@hidden>
- Date: Sat, 22 Jun 2019 17:09:40 -0700
On 2019 Jun 19, at 21:35, Kurt Bigler via Cocoa-dev <email@hidden>
wrote:
> I would like to be able to traverse the top-level object list in a macOS nib
> without instantiating the objects. But I'd like to be able to get at the
> attributes of each top-level item to decide whether to instantiate it, and
> then of course to control instantiation on an object-by-object basis based on
> that. Is this possible?
Using available API, you must *load* the nib file. The method
loadNibNamed(_:owner:topLevelObjects:) will return an array of top level
objects. If that is too much “instantiate” for you, then I think the answer to
your question is “no”, unless you want to reverse-engineer the nib file format,
then have your app read that file.
I think the correct solution to this problem, if you are trying to reduce
resource usage, is to put the views or whatever you’re trying to avoid
instantiating into separate nib files, and only load the nib files you need.
_______________________________________________
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