Dynamic Button Layout without hard coding positions

Posted by mmc on Stack Overflow See other posts from Stack Overflow or by mmc
Published on 2009-07-13T21:38:30Z Indexed on 2010/04/15 13:03 UTC
Read the original article Hit count: 211

I would like to implement a view (it will actually be going into the footer of a UITableView) that implements 1-3 buttons. I would like the layout of these buttons (and the size of the buttons themselves) to change depending on which ones are showing. An example of almost the exact behavior I would want is at the bottom of the Info screen in the Contacts application when you are looking at a specific contact ("Add to Favorites" disappears when it is clicked, and the other buttons expand to take up the available space in a nice animation).

As I'm running through the different layout scenarios, I'm hard coding all these values and I just think... "this is NOT the way I'm supposed to be doing this."

It even APPEARS that Interface Builder has some features that may do this for me in the ruler tab, but I'll be darned if I can figure out how they work (if they work) on the phone.

Does anyone have any suggestions, or a tutorial online that I could look at to point me in the right direction?

Thanks much.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch