Help with creating CustomViews
Help with creating CustomViews
- Subject: Help with creating CustomViews
- From: Jean-Henri Duteau <email@hidden>
- Date: Mon, 15 Feb 2010 19:19:01 -0700
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 (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