Re: Auto-layout: how do I make the other side "win"?
Re: Auto-layout: how do I make the other side "win"?
- Subject: Re: Auto-layout: how do I make the other side "win"?
- From: Daryle Walker <email@hidden>
- Date: Mon, 03 Apr 2017 11:57:24 -0400
> On Apr 1, 2017, at 5:00 PM, Quincey Morris <email@hidden> wrote:
>
> On Apr 1, 2017, at 12:07 , Daryle Walker <email@hidden <mailto:email@hidden>> wrote:
>>
>> I got a feeling that, since the interior of the window and the exterior of the view are probably bound, that the auto-layout system is choosing the view’s smaller size over the window’s bigger one. How do I reverse this? Or do I have to manually increase the size of all the interior views?
>
> The window’s content rect *is* the frame of the content view, and you’re right that the window is initially resized to the content view size from the storyboard. In IB, you should set the content view size, not the window size, to the desired initial value. If you have a complete set of auto-layout constraints, that should be the only manual part of the adjustment, and all the subviews should resize correctly.
When I select the window in the window controller’s scene in the storyboard, its content size is 800x450. It doesn’t show that way on app run. The view that’s connected to it, a split-view (top & bottom), is still set to the default 450x300. The two splits are also at the default 450x300. The bottom split is a tab-view, whose two tabbed views are also at the default 450x300. I haven’t added any constraints yet.
It seems that I do have do design from the inside-out and guess the shrunken sizes of my components, instead of having my sizes from the outside-in and having auto-layout shrink the interiors.
> However, you have to be a bit careful. By defaults, windows are restorable. On the second and subsequent runs of your app, your window will restore to the last saved size, and the content will be resized to the window — the opposite of what happens on first run. You should disable restoration (in the Run scheme options) while you’re testing your initial window size. In addition, document windows are subject to resizing on opening, if you use a window autosave identifier.
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
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