页面布局autoresizing

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
    view.backgroundColor = [UIColor colorWithRed:0 green:1 blue:1 alpha:0.8];
    [self.view addSubview:view];
    //autoresizingMask
    view.autoresizingMask = UIViewAutoresizingFlexibleWidth;
//    UIViewAutoresizingNone                 = 0,不进行自动调整
//    UIViewAutoresizingFlexibleLeftMargin   = 1 << 0,自动调整与superview左侧距离,右侧距离保持不变
//    UIViewAutoresizingFlexibleWidth        = 1 << 1,自动调整宽度,保证与superview左右距离不变
//    UIViewAutoresizingFlexibleRightMargin  = 1 << 2,自动调整与superview右侧距离,左侧距离保持不变
//    UIViewAutoresizingFlexibleTopMargin    = 1 << 3,顶部柔软,底部固定
//    UIViewAutoresizingFlexibleHeight       = 1 << 4,自动调整高度,保证与superview上下距离不变
//    UIViewAutoresizingFlexibleBottomMargin = 1 << 5底部柔软,顶部固定
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


你可能感兴趣的:(页面布局autoresizing)