Re: creating and using a View xib
Re: creating and using a View xib
- Subject: Re: creating and using a View xib
- From: Chris Hanson <email@hidden>
- Date: Wed, 11 Jun 2008 00:47:45 -0700
On Jun 10, 2008, at 5:00 PM, Jerry Isdale wrote:
How do I get that View/Controller to show up in the application
window?
Do I have to programatically load the XIB and position the view
within the app?
Do I have to turn it into an IB library object, then drag from
library to window?
Use an NSViewController - or a subclass of it - to manage the view.
The NSViewController is File's Owner for the view nib/xib, and has a
"view" outlet to it. You can also use subclasses of NSViewController
to provide "supervisory" behavior for particular views.
Thus whenever you want a particular kind of view you can instantiate
its corresponding NSViewController. Then just add its view to
whatever other view you care about, such as the content view of a
window.
This is a really handy way to create and manage re-usable content for
Cocoa applications. There are some great articles here:
NSViewController, the New C in MVC (parts 1 through 3)
http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-of-3/
http://katidev.com/blog/2008/04/17/nsviewcontroller-the-new-c-in-mvc-pt-2-of-3/
http://katidev.com/blog/2008/05/26/nsviewcontroller-the-new-c-in-mvc-pt-3-of-3/
And of course there's also some great information in the
NSViewController documentation.
-- Chris
_______________________________________________
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