Re: Auto Layout Question
Re: Auto Layout Question
- Subject: Re: Auto Layout Question
- From: Quincey Morris <email@hidden>
- Date: Wed, 24 May 2017 10:11:17 -0700
On May 24, 2017, at 08:52 , Dave <email@hidden> wrote:
>
> Maybe I am going about this in the wrong way?
Using stack views seems like the hard way. Why can’t you apply constraints directly to the 4 views? I’d suggest adding constraints to the labels to center them over their graphic views, with a fixed vertical spacing. Then apply constraints to the graphic views for aspect ratio, and to use the available height or width of the parent view to place them side by side with appropriate spacing. If this unit of 4 views needs to be an element of a larger layout, you might choose to embed them in a custom view which has its own constraints relative to the larger layout.
Stack views just aren’t very good for situations where you need cross-“cell” constraints. Stack views work best (and I wish the documentation would say this) when you *don’t* add constraints, but rely on the built-in behavior to lay things out. IOW, stack views are a way of getting sophisticated behavior without having to delve into constraints.
If this was macOS, I’d suggest using NSGridView instead of NSStackViews, but this new layout functionality hasn’t reached iOS yet.
_______________________________________________
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