Re: Using an IB-built view multiple times
Re: Using an IB-built view multiple times
- Subject: Re: Using an IB-built view multiple times
- From: Ricky Sharp <email@hidden>
- Date: Tue, 20 Sep 2005 18:03:24 -0500
On Sep 20, 2005, at 11:08 AM, Christopher Drum wrote:
Working on a project that uses an NSView that contains multiple
subviews. If I build a view in IB and link it to my AppController,
I don't have any problems cramming that IB-designed view into my
main view... and in fact that works quite nicely for my purposes
thus far.
The problem I'm running into is that I want to be able to set up a
sort of "template" view that I can insert into a primary view
repeatedly. The idea is that the template would show information
related to one instance of a class, then I'd reuse that template to
show information related to another instance of that same class.
Typically I would use an NSTableView to show the information, but
the formatting and user needs are such that the TableView is too
limiting.
It seems that this is possible if I create the entire template view
programatically, then instantiate one anytime I need it. However, I
was hoping there was some kind of procedure that would allow me to
build the template graphically, then clone out instances of that
view as needed.
When you say "build the template graphically", do you mean dragging
out instances of them in IB? If so, I'd recommend an IB palette.
palette items can be composites of other items. For example, I have
an IB palette with a "radio group" item. When I drag that to my
window, it creates an NSMatrix subclass (the radio group) filled with
a couple of NSActionCell subclasses (individual radio buttons). You
then gain the benefit of creating custom inspectors for your items so
you can set attributes as needed, all within IB.
NSView doesn't seem to adhere to <NSCopying> protocol. So, I'm
getting myself a little lost here. Is it even possible to subclass
NSView to adhere to <NSCopying>?
You can definitely do that, but have you explored multi-part cells
instead of views/subviews? Depending upon your needs, you may be able
to come up with an NSCell subclass that you would then add to a table
view.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden