typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0,//父视图右边框向左到视图的距离为0 UIViewAutoresizingFlexibleWidth = 1 << 1,//和父视图一样宽 UIViewAutoresizingFlexibleRightMargin = 1 << 2,//父视图左边框向右到视图的距离为0 UIViewAutoresizingFlexibleTopMargin = 1 << 3,//父视图下边框向上到视图的距离为0 UIViewAutoresizingFlexibleHeight = 1 << 4,//和父视图一样高 UIViewAutoresizingFlexibleBottomMargin = 1 << 5//父视图上边框向下到视图的距离为0};
View.superview.autoresizesSubviews = YES;
视图的俯视图要允许视图可以变化
View.superview.autoresizesSubviews = YES view.autoresizingMask= UIViewAutoresizingFlexibleTopMargin;//子视图和父视图下面对齐