Adapt UILabels and UIImageViews in app in esthetical and practical ways using Xcode 4

When I'm loading images and labels to my DetailViewController, sometimes some of the strings I'm populating the Labels with are containing more words/longer sentences than other ones and have to display an exstra line to display the whole Label. If so, I would like the label under it to "move down" so it makes room for the extra line of the Label above, if you understand what I mean! Same thing with images: if an image (for example under the header title) is smaller than other ones, it leaves a big gap between image and text.

I'm also experiencing similar adjusting problems from now to then and I'm sure other beginners and having these problems as well. I'm also sure there are ways to handle it so I don't have to make a whole new ViewController just because an object contains a few more words in a string and different image dimentions.

Are there codes I can use to handle this kind of adapting or can I do it in the Storyboard? More information around the subject is appreciated.

Answers


In those cases I change the layout programmatically. Then IB is just some work aid for defining them and a preview tool and useful to prototype and measure the dimensions of the view items.

As I do the same anyway when my app supports landscape and portrait.

It gets a bit tricky only when table cells have different hights as a result of those reactions ot individual sizes of text and image items. The layout logig then is spread over two classes. A custom cell is in charge with layouting the content of a cell and some methods within the table view controller are in charge with providing the height of each cell. But despite of that it is pretty much straight forward.


Need Your Help

How to get body of a POST in php?

php rest post

I submit as POST to a php page the following: