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 07:52:18 +0200
An interesting discovery. I went through all properties one by one in
NSSplitView, comparing ones that are set automatically to NSSplitView in a
MainMenu.xib and the one that are set automatically in
MyViewController.xib. When I load NSSplitView as part of another xib, its
property "arrangesAllSubviews" gets set to NO, which makes the split view
not work properly. Setting it to YES explicitly in viewDidLoad (of
NSViewController's subclass) seems to resolve the problem. I don't know
why, though. This property appeared first in ElCap 10.11.
2015-10-24 21:51 GMT+03:00 Nick <email@hidden>:
> Hi
> I am trying to create an NSSplitView-based application.
> For the sake of modularity, I would like to separate different parts of
> the app into several view controllers (each has its own xib).
>
> The problem is when I add a split view as a child view of
> NSViewController.view, then load my view controller, and set my main
> window's contentView to viewController.view.
>
> All controls show except for NSSplitView.
>
> I tried this multiple times, with different test projects and every time I
> get this problem.
>
> It can be easily replicated. Just create a new non-storyboard based cocoa
> project, create a new NSViewController subclass, drag an NSSplitView onto
> its view into its xib, and in your AppDelegate have the following
>
> @interface AppDelegate ()
>
>
> @property (weak) IBOutlet NSWindow *window;
>
> @property TestVC *vc;
>
> @end
>
>
>
> @implementation AppDelegate
>
>
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
>
> self.vc = [[TestVC alloc] initWithNibName:@"TestVC" bundle:nil];
>
> self.window.contentView = self.vc.view;
>
> }
>
>
> Where TestVC - is the name of your NSViewController's subclass.
>
>
> What am I doing wrong?
>
>
> What is interesting - when I do not load the view from a separate xib, but
> have the view in MainMenu.xib (even if it is not a subview of the main
> window's content view), the split controller shows normally, as expected.
>
>
> I am using Xcode 7.0.1, OS X ElCapitan 10.11
>
>
> Thanks for help!
>
>
_______________________________________________
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