Hey Torsten -
It would probably be easiest to factor your view into a separate NIB
and then load that nib multiple times. If you have reasons for not
doing that, you could instead take the approach you suggested below.
To get your outlets to roundtrip through the keyed archiver, you need
I've just thought of another solution that might be cleaner and more
obvious.
If your substrate view (the one that contains the rest of the
controls) is a custom view class, you need only implement the
NSCoding protocol and conditionally encode the outlets yourself.
Then when the view is
On 14 Jun 2008, at 11:10 am, Graham Cox wrote:
However, I'm not relying on the view having outlets to its subviews
set - in fact I don't have any outlets. Instead I embed the controls
normally and find them later using their tags. This works well in my
case because I'm not using the tags o
On Fri, Jun 13, 2008 at 4:05 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote:
> Hm ...factored out NIBs before. But in this case it just felt a bit award to
> use this for potentially like a few hundred items.
If you use NSNib, you can load the file just once, then instantiate it
many times. This avoi
I've done exactly this in the past and it worked fine. I just checked
my code to see if I was doing anything different from you - I'm not:
view = [NSUnarchiver unarchiveObjectWithData:[NSArchiver
archivedDataWithRootObject:prototypeView]];
However, I'm not relying on the view having outlet
Hm ...factored out NIBs before. But in this case it just felt a bit
award to use this for potentially like a few hundred items.
Is your current approach working smoothly? No? Then the usual way
is probably best. ;-)
--
I.S.
___
Cocoa-dev mail
On Jun 13, 2008, at 13:01, I. Savant wrote:
I have a NSView "template" in my nib that I am duplicating in a
container
view like this:
Unfortunately (but to no big surprise) this does not set the
IBOutlets.
Is there any other way but injecting the references myself?
If you have a 'reus
> I have a NSView "template" in my nib that I am duplicating in a container
> view like this:
> Unfortunately (but to no big surprise) this does not set the IBOutlets.
> Is there any other way but injecting the references myself?
If you have a 'reusable' portion of UI, the (usually) best approa
I have a NSView "template" in my nib that I am duplicating in a
container view like this:
- (void) awakeFromNib
{
NSView *view;
NSData *templateView = [NSArchiver
archivedDataWithRootObject:myView];
view = [NSUnarchiver unarchiveObjectWithData:templateView];
[self addSubvie