Re: Finding windows made in Interface Builder?
Re: Finding windows made in Interface Builder?
- Subject: Re: Finding windows made in Interface Builder?
- From: Kai-Mikael Jää-Aro <email@hidden>
- Date: Wed, 11 Jul 2007 19:01:09 +0200
Uli Kusterer kirjoitti 2007-07-11 kello 18:44:
On 11.07.2007, at 18:21, Kai-Mikael Jää-Aro wrote:
I'm laying out a circuit design and the user can double-click on
each unit to get up an info window specific for that type of
unit. So, the window depends on the clicked-on unit and ideally
I'd like to bind the window identity to the unit, but the units
are of course created dynamically by the user. I'd rather not tie
knowledge of the info window to the layout view, but AIUI, I have
to connect an instance of some class to the window. Should I use
a prototype object that I then copy for each new unit, rather than
instancing new ones directly from the class? In that case I could
have an outlet
In general, you'll want a class that wraps one window. You could
have this class load a different NIB file each time by simply
passing in the NIB name. So, if you had a capacitor, a reed contact
and a lightbulb, you'd do:
[[KMJADescriptionWindowController alloc] initWithNibName:
[currentObject name]];
(where [currentObject name] would return "Capacitor", "Reed
Contact" or "Lightbulb", depending on the current object and then
you'd just have -initWithNibName: pass that string to loadNibNamed.
You could then build an array of KMJA DescriptionWindowController
objects in an array if you have to show several of those at the
same time. Alternatively, you could just have one such object that
gets created and torn down again, replaced by a new one.
Ah! That sounds just like what I was looking for. I'll try that and
see how it goes. In the meantime, thank you all for your help!
_______________________________________________
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