In Xcode 4 you should be able to design UI interfaces that do resize based on their content. Still it looks that the are some missing pieces regarding how to obtain this.
I have a button that is configured in the XIB file to resize to the right and it has plenty of space to do that.
The problem is that it doesn't seam to resize the button when the label is updated.
This can be fixed by adding a [button sizeToFit];
after the label is changed.
Still I am looking for a solution that works without adding this manual step into the code.
I mention that there is enough space to expand the button further, still sizeToFit
seams to to enlarge the button but still not enough to fit the entire text.
What am I missing?
In XCode 4.5 and above, this can now be done by using 'Auto-layouting / Constraints'.
Major advantages are that:
A few disadvantages:
Coolest thing is we get to focus on declaring an intent such as:
Here is a simple tutorial to get introduced to auto-layouting: http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
For a more detailed look at things, go to: http://www.techotopia.com/index.php/An_Introduction_to_Auto_Layout_in_iOS_6
It takes some time at first, but it sure looks like it will be well worth the effort.
Cheers!