Re: Programmatic autolayout problem
Re: Programmatic autolayout problem
- Subject: Re: Programmatic autolayout problem
- From: Rick Mann <email@hidden>
- Date: Mon, 25 Feb 2013 22:46:00 -0800
On Feb 25, 2013, at 22:38 , Kyle Sluder <email@hidden> wrote:
> Yes for the hugging constraints. Otherwise the window size will win as
> the user drags to resize the window.
>
> Think of window drag-resizing as installing a temporary constraint that
> follows the mouse at priority 500. Think of content hugging as
> installing an equality constraint with a constant equal to the view's
> intrinsicContentSize in the given dimension, operating at the priority
> you specify. If the content hugging priorities of your text fields have
> higher priority than the window-resizing constraint, the hugging
> constraints will win and the window frame will stay put.
>
> Note that the window itself won't notice this outside of a drag
> operation, so it will still put up the drag-to-resize cursor when the
> mouse gets near the window edge. If you know you want the window to stay
> a fixed size, you'll probably want to turn off the Resizable flag for
> your window. Auto layout should still resize the window appropriately.
>
> (Content compression resistance is different from content hugging
> because compression resistance is an inequality, whereas hugging is an
> equality. Inequalities have infinite solutions, so it's easier to
> accidentally underspecify your constraint system once you start
> incorporating them.)
Gotcha.
Well, it's closer to working, but still not correct. If I don't pre-size the window, it never gets resized, even though all the constraints are above 500. Vertically it seems to be perfectly hugging my labels (verified by changing the font size in IB without re-adjusting the views in IB). But horizontally it's still not hugging. It looks like the labels aren't shrinking horizontally enough.
The fixes space between the two labels also isn't the 5 it's specified to be.
Frame: {{288, 0}, {96, 16}}
view1: {{2, 1}, {34, 14}}
view2: {{35, 1}, {59, 14}}
Seems to be -1, for some reason.
--
Rick
_______________________________________________
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