Re: NSSplitView in a separate NSWindowControl doesn't show for some reason
Re: NSSplitView in a separate NSWindowControl doesn't show for some reason
- Subject: Re: NSSplitView in a separate NSWindowControl doesn't show for some reason
- From: Nick <email@hidden>
- Date: Sun, 25 Oct 2015 19:50:03 +0200
- X_v_e_cd: 09d3803e2250e9e3110599e104fb82e2
- X_v_r_cd: 733ce6aacf70f06bb3584f24c8c4233c
Graham,
Thank you for your answer.
Just to follow up - yes, I tried adding the view as a subview, instead of
replacing the content view of the window. But the result was the same - the
split view kept losing its arrangesAllSubviews property, whenever the split
view was loaded from a different XIB than the window it was placed onto. So
I ended up explicitly setting arrangesAllSubviews = YES in the -viewDidLoad of
my NSViewController.
2015-10-25 14:14 GMT+02:00 Graham Cox <email@hidden>:
>
> > On 25 Oct 2015, at 5:51 am, Nick <email@hidden> wrote:
> >
>
> > What am I doing wrong?
> >
>
>
> This:-
>
> > self.window.contentView = self.vc.view;
> >
>
> A NSWindow is not itself a NSView, so it needs to have a closely
> associated view that hosts all the rest of the window’s content. That is
> the contentView. It should remain behind all other views, and be the root
> view of the window’s view hierarchy. It is owned by the window, and is
> exposed mainly so that you can add subviews to it, though you can replace
> it with a specific view subclass if that makes sense - it still must be the
> root view in your window. There’s some new NSWindow API in 10.10+ that
> allows you to instantiate a window and set the contentView using a view
> controller - maybe that’s confusing you, or this addition has exposed a
> problem with what you’re doing that you happened to get away with
> previously.
>
> What you’re attempting sounds reasonable, just that setting any child view
> to the window’s root view is obviously going to mess up the view hierarchy,
> with undefined results.
>
> I’m not sure what your code ought to be doing exactly, but something like
> this replacing the line I’ve picked out may do it:
>
> [self.window.contentView addSubview:self.vc.view];
>
>
>
> —Graham
>
>
>
_______________________________________________
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