Re-using the same NIB on two owners

2011-06-26 Thread Daniel Luis dos Santos
Hello,

I have an application that has two windows. Each window is associated to a 
controller class. On one method of each class I load another NIB that has a 
subordinate window. That subordinate NIB has outlets and actions that should be 
associated to the loading class, so on the NIB I set the File's Owner to be of 
the class that loads it.

My problem is that I need to load the same NIB from two different classes, so 
the owner is different according to which class I load it from.
Is there another way to do it without the file's owner ? Subclassing the 
controller ?

Thanks for replying___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Re-using the same NIB on two owners

2011-06-26 Thread Sherm Pendley
On Sun, Jun 26, 2011 at 11:16 AM, Daniel Luis dos Santos
daniel.d...@gmail.com wrote:

 My problem is that I need to load the same NIB from two different classes, so 
 the owner is different according to which class I load it from.
 Is there another way to do it without the file's owner ? Subclassing the 
 controller ?

One way would be to declare a common superclass, of which both owner
classes are subclasses, that implements the outlets  actions that are
connected in the .xib. Each subclass can then override the actions as
needed. In IB (or Xcode 4, as the case may be), just define the
file's owner in the .xib as the parent class.

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com