It sounds a lot to me (and I could be wrong here) that you're trying to implement something along the lines of an ActiveX control as they were back when I used Visual Basic 5, in the sense that you want a "control" which is really a collection of other controls, and to be able to drag them around in IB and treat this collection as if they were a single control.
While it is possible using IB Plugins, that's not really what IB's plugin system was intended for. This plugin system was meant more for control that are actually custom, such as a WebView object or PDFView or IKImageView or ABPeoplePickerView. (These are all custom classes which Apple has included into IB via its own default set of plugins.) This is to say, the plugin system is intended for actual subclasses of NSView or NSControl (or NSCell) which implement very specific and unique behavior, and where it's important (or at least desired by management) to be able to set their settings in IB during design-time. What you're doing can easily be accomplished in code, by having an NSViewController that points to your own XIB file, and by creating instances of this view controller and inserting its view into other views. This is the canonical way. Not only do you get more flexibility by doing it in code (and a lot less repetition in IB) but this method allows you to encapsulate another level of abstractness inside your NSViewController subclass, thus cleaning up your code (a lot). This is what more experienced Cocoa coders generally do instead of what you're trying to do. -Steven On Mon, Feb 15, 2010 at 9:19 PM, Jean-Henri Duteau <duteaudes...@gmail.com>wrote: > Hi all, > > I'm a newcomer when it comes to Cocoa development. I have some good books > and they discuss the possibility of CustomViews but the views they create > aren't the type that I'm interested. I've scoured the web and haven't found > exactly the help I need and I've tried the trial-and-error method and it > hasn't worked. > > What I'm trying to do is the following: > -I have a number of model objects, different instances of the same class. > -I want to create a CustomView that would enable the display of these > objects. > -The CustomView is defined in its own NIB file. It consists of a bunch of > NSTextField objects laid out in NSBox. > -I then want to use that CustomView all over the place. :) But for > starters, I'm trying to create a window with 10 instances of my CustomView. > -I want to drop the CustomView in other NIB files and set up the > actions/outlets/etc. > > The path that I took that seemed to give the best promise was: > I created a CustomViewController (subclassing NSViewController) > In MyDocument.init, I init the CustomViewController with my CustomView NIB > file. > In MyDocument.windowControllerDidLoadNib, I call viewController.view > setFrame: and then windowController.window.contentView addSubView. > > That manages to get my CustomView to show up in the document's window. But > that was done programatically and not in IB. > > Then I looked at the DragAround sample code on the Apple site. This seemed > to be exactly give tips for exactly what I wanted, except that the > DragAroundView draws itself, there is no NIB file for the view. > > If someone can point me to some sample code, that would be great. In the > meantime, I'll keep trying. > > Jean Duteau > > _______________________________________________ > > 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/steven.degutis%40gmail.com > > This email sent to steven.degu...@gmail.com > -- Steven Degutis http://www.thoughtfultree.com/ http://www.degutis.org/ _______________________________________________ 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