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 <graham....@bigpond.com>:

>
> > On 25 Oct 2015, at 5:51 am, Nick <eveningn...@gmail.com> 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 (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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to