Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIView Autoresizing Resources

Tags:

I've been working on autoresizing a custom UIView and Apple has very little to say on this. What's more, based on SO feedback, Apple's documentation is actually wrong in some areas. Finally, even though there are six resizing components in Interface Builder and six for setAutoresizingMask: they don't seem to correlate at all. For example, setting the width spring in IB has a different effect from setting the autoresizingMask to UIViewAutoresizingFlexibleWidth when rotating the device.

Are there any good resources for learning about how resizing works on the iPhone?

Edit:

I understand the basic concepts Apple uses such as contentMode, and I've read through the UIView documentation. I'm looking for something that explains a little more deeply what the IB settings do in terms of what's available in the SDK programmatically.

like image 248
David Kanarek Avatar asked Jan 24 '10 21:01

David Kanarek


2 Answers

setting the autoresizingMask to UIViewAutoresizingFlexibleWidth, is equivalent to setting the width spring, plus both the left and right struts in Interface Builder (the struts mean that the edge is not flexible). If you wanted to replicate the behavior of only setting the width spring, but not the left and right struts, you would have to set autoresizingMask to UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin

like image 114
user102008 Avatar answered Sep 30 '22 23:09

user102008


I found this post helpful in understanding iOS autoresizing.

http://www.techotopia.com/index.php/IOS_4_iPhone_Rotation,_View_Resizing_and_Layout_Handling

like image 39
shyamsundar2007 Avatar answered Sep 30 '22 22:09

shyamsundar2007