Multiple views in a nib file?
Multiple views in a nib file?
- Subject: Multiple views in a nib file?
- From: Jean-Nicolas Jolivet <email@hidden>
- Date: Mon, 24 Nov 2008 02:17:53 -0500
What I'm trying to do is a bit weird but, it seems to be the only way
I can think of implementing such a concept, anyway I'll do my best to
explain... so I have an abstract class (let's call it Tools)...
basically it just defines some methods/properties that the subclass
should implement (as I said... an abstract class)...
Each subclass of Tools must have a different custom view assigned to
it (i.e. the "Pencil" class, which is a Tool subclass, has a custom
view, the "Paintbrush" class has a custom view etc...), so I added a
"NSView *view" properties to my base "Tool" class.
The problem is, I'm not sure how I can store those custom views and
associate them with their respective subclasses once they are
instantiated. I'm able to do it if each views are in separate nib
files, that way I just add a "nibName" property to my Tool class, so
that every subclass of it has a distinct nib name, I load that nib and
load the only view in it...
however, this doesn't really seems like the ideal way of doing this...
wouldn't it be more practical to save all those views in only one nib
file? But the problem is, if I do it that way I don't know how to
access a specific view from that nib file... I thought about trying to
access it via the "Interface Builder Identity" name property but
apparently this isn't accessible programatically...
Obviously, if I store all my custom views in the same nib file, and
each subclass of Tool has to be associated with one of those custom
views, I can't really set a File Owner to that nib file and define an
outlet to be associated with any of the view since the "File Owner"
could basically be any of Tool's subclasses....
Should I just store each custom view in their respective nib
files??? Or perhaps I'm just looking at this the wrong way?
Any help would be appreciated...
Jean-Nicolas Jolivet
email@hidden
http://www.silverscripting.com
_______________________________________________
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