Re: NSView's in Separate NIB
Re: NSView's in Separate NIB
- Subject: Re: NSView's in Separate NIB
- From: Dave <email@hidden>
- Date: Sat, 05 Sep 2015 11:47:07 +0100
Hi Lee Ann,
> On 4 Sep 2015, at 21:25, Lee Ann Rucker <email@hidden> wrote:
>
> NSViewController doesn’t really work that way. It’s like an NSWindowController - it manages one view and handles all the nib unloading top-level objects stuff for you. (Trust me, you do not want to manage top-level objects yourself)
>
> So instead of
>
>> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l
>> myDetailViewController = [[LTWDetailViewController alloc] initWithDetailView:theDetailView];
>
> what you’d want is
>
> myDetailViewController = [[LTWDetailViewController alloc] initWithNibName:@“ LTWDetailViewY”]
> myDetailView = [myDetailViewController view];
>
The idea is a have a ViewController with a common Title View already set up in the view controller NIB file “LTWDetailViewController.xib”.
So doing:
myDetailViewController = [[LTWDetailViewController alloc] initWithDetailView:nil];
would result in just the header being displayed:
View
TitleView
I then have a number of NIB files that just contain Views (DetailViewX, DetailViewY etc), I want to load one of them and pass it into initWithDetailView: so that it adds the view passed to it as a subview, like so:
View
TitleView
DetailViewY
So:
myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l
myDetailViewController = [[LTWDetailViewController alloc] initWithDetailView:theDetailView];
Would do this.
All the Best
Dave
_______________________________________________
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