• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: duplicating views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: duplicating views


  • Subject: Re: duplicating views
  • From: Jonathan Hess <email@hidden>
  • Date: Tue, 17 Jun 2008 11:47:49 -0700

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 to implement the NSCoding protocol on the various objects that are referenced by 'myView'.

NSCoding : http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html

Good Luck -
Jon Hess

On Jun 13, 2008, at 12:55 PM, Torsten Curdt wrote:

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 addSubview:view];

   view = [NSUnarchiver unarchiveObjectWithData:templateView];
   [self addSubview:view];

Unfortunately (but to no big surprise) this does not set the IBOutlets.
Is there any other way but injecting the references myself?


cheers
--
Torsten
_______________________________________________

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

_______________________________________________

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


References: 
 >duplicating views (From: Torsten Curdt <email@hidden>)

  • Prev by Date: Re: Rethinking my approach; rather overwhelmed.
  • Next by Date: [MEET] LA CocoaHeads this Thursday, 6/19 at 7:30pm
  • Previous by thread: Re: duplicating views
  • Next by thread: How to mix Check boxes and Radio buttons in NSOutlineView?
  • Index(es):
    • Date
    • Thread