Graham Perks
Graham Perks

Reputation: 23400

Xcode 4 - IB - evenly distribute controls?

In Interface Builder I have a bunch of text fields that sit vertically. I want them evenly distributed in the vertical space, and all to be identically sized.

I've found the Alignment menu that lets you line up items. I can't find a menu for distribution or sizing. Does Xcode 4 include those layout commands?

Upvotes: 11

Views: 5819

Answers (3)

Fábio Oliveira
Fábio Oliveira

Reputation: 2346

Hope this helps: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html

The concept is to use some spacer views and set them to be all the same size. There are some tricks with the priorities to be done so please follow the link for a definite answer.

Upvotes: 2

Alex Gray
Alex Gray

Reputation: 16463

The answer is, NO. And I HATE having to be "one of those people" that has to tell you so. I assume what you are looking for is something similar to OmniGraffle's quintessential feature, "Canvas, Grid, Alignment". It is THE TOOL that makes OG so damned good.

alignment, dumbies

It amazes / disgusts me that a company worth $100 billion is unable to get this basic tenet of visual layout right, when a company writing software for that same idiotic company's own platform for years, has had this down for as long as I can remember. The Xcode team needs to pull it together. For example, KVO Bindings are, and have always been a joke - a not so funny one - that are impossible to implement, plug-ins are gone… And IMHO, Lion auto-layout is Unusable. They need some NEW PEOPLE or something, maybe that aren't developers, or something.. Cause Xcode is getting harder to use, not easier. It looks better, and is better organized… but its obvious that there is no "big thinker" inside that group that is willing to question their fragile and awkward paradigms.

the jokes on us, lion autolayout

Are they kidding with this? How about this Xcode? _Shut up, line up the buttons, distribute then evenly - like 99% of people are going to want, 99% of the time - and dont puke meaningless lines all over everything?__ And what the hell is Content Hugging Priority and Content Compression Resistance Priority? I read the docs twice and still have NO IDEA what those are or how to use them. I'm no Einstein, but If I can't "get it" after making a concerted effort… It's too hard. lol. Ok, I need to go mark futile rant off my to-do list, now.

Upvotes: 28

McWolfe
McWolfe

Reputation: 188

The boring answer is to type in the coordinates manually. Not very smooth, but it gives you exact control over the placement at least (in the Size inspector).

Upvotes: 1

Related Questions