• 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
Multiple views in a nib file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Multiple views in a nib file?
      • From: Graham Cox <email@hidden>
    • Re: Multiple views in a nib file?
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: NSTypesetter problem
  • Next by Date: Re: NSPopupUpButton not showing checked menu items
  • Previous by thread: Re: NSTypesetter problem
  • Next by thread: Re: Multiple views in a nib file?
  • Index(es):
    • Date
    • Thread