On Sat, Aug 31, 2013, at 08:59 AM, Steve Mykytyn wrote:
> Having done this a number of times with springs and struts, I thought a
> telephone dial keypad would be a good way to learn the ins and outs of
> auto
> layout
> 
> - 5 rows of three buttons each
> - Each button has a label (2) and optional label below (abc)

When you say "optional," I assume you're okay with always reserving the
space for that label? Otherwise this isn't easy in spring s-and-struts
_or_ auto layout.

> - The width of the buttons always the same.

Add equal width constraints to all the buttons. (And probably equal
heights, too.)

> - The height of each button changes between 3.5 and 4 inch iPhones

You have two options here:
1. Define the height of your buttons using constraints that relate by
some multiplier to the height of your superview. Sadly, you can't do
this in IB. (It would be worth filing a bug!)
2. Leave the height of your views undefined and let their height be
defined by the margins relative to the superview.

> 
> Seems like this should be a straightforward use of auto layout, but I
> can't
> seem to get to a solution that does not have a very large number of
> constraints, which are very finicky if you try to adjust them.
> 
> It's also very difficult to start with a row of three buttons, say, get
> that right, then duplicate that row and add/fix up constraints?

What version of Xcode are you using?

--Kyle Sluder
_______________________________________________

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