autoresizingMask

本文为大地瓜原创,欢迎知识共享,转载请注明出处。
虽然你不注明出处我也没什么精力和你计较。
作者微信号:christgreenlaw
用于描述:当superview的bounds改变的时候,接收者如何resize自身。
是一个bit mask
当view的边界改变时,view自动根据其subview的autoresizeMask来resize其subview。可以用C的比特OR操作符对UIViewAutoresizing中所描述的常量进行结合,声明一份mask值。这样你可以指明view的哪些dimension应该相对于superview进行grow还是shrink。这个值默认是UIViewAutoresizingNone,也就是说这个view不应该被resize。
When more than one option along the same axis is set, the default behavior is to distribute the size difference proportionally among the flexible portions. The larger the flexible portion, relative to the other flexible portions, the more it is likely to grow. For example, suppose this property includes the UIViewAutoresizingFlexibleWidth and UIViewAutoresizingFlexibleRightMargin constants but does not include the UIViewAutoresizingFlexibleLeftMargin constant, thus indicating that the width of the view’s left margin is fixed but that the view’s width and right margin may change. Thus, the view appears anchored to the left side of its superview while both the view width and the gap to the right of the view increase.
If the autoresizing behaviors do not offer the precise layout that you need for your views, you can use a custom container view and override its layoutSubviews method to position your subviews more precisely.
【autoresizingMask】如果autoresizing的行为没能提供你想要的样式,你可以自定义一个container view,重写其layoutSubviews方法来准确地放置你的subview。

    推荐阅读