原文参考:http://www.cnblogs.com/jiangyazhou/archive/2012/06/26/2563041.html
UIView中有个属性是autoresizingMask,该属性是用来控制控件的自适应。
上图剪切自iOS 4.2 Library
UIViewAutoresizingNone:控件相对父视图坐标值不变;
UIViewAutoresizingFlexibleLeftMargin:到左边的距离随着父视图的宽度按比例改变;
UIViewAutoresizingFlexibleWidth:控件的宽度随着父视图的宽度按比例改变;
UIViewAutoresizingFlexibleRightMargin:
UIViewAutoresizingFlexibleTopMargin:
UIViewAutoresizingFlexibleHeight:控件的高度随着父视图的高度按比例改变;
UIViewAutoresizingFlexibleBottomMargin:
以上属性可多个同时设置,如:
- self.subView.view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;