標籤:
?UIView *blueView = [[UIView alloc] init];??? [self.view addSubview:blueView];
??? blueView.backgroundColor = [UIColor blueColor];
?????? blueView.center = self.view.center;??? blueView.bounds = CGRectMake(0, 0, 150, 150);??? self.blueView = blueView;???
??? /*
???? Flexible 靈活的,自由的
????
???? typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) {
???? UIViewAutoresizingNone ??????????????? = 0,
???? UIViewAutoresizingFlexibleLeftMargin ? = 1 << 0,
// ? 左邊是自由的,右邊是固定的(與storyboard中相反)
???? UIViewAutoresizingFlexibleWidth??????? = 1 << 1,
// ? 寬度是可展開的
????
???? UIViewAutoresizingFlexibleRightMargin? = 1 << 2,
//??? 右邊是自由的,左邊是固定的(與storyboard中相反)
???? UIViewAutoresizingFlexibleTopMargin??? = 1 << 3,
//??? 頂部是自由的,底部是固定的(與storyboard中相反)
???? UIViewAutoresizingFlexibleHeight ????? = 1 << 4,
// ? 高度是自由的(高度是可展開的)
???? UIViewAutoresizingFlexibleBottomMargin = 1 << 5
//??? 底部是自由的,頂部是固定的(與storyboard中相反)
???? };
????
????
???? */
//? 四周固定,中間靈活
//??? redView.autoresizingMask? = ? UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
//? 四周靈活,中間固定
//? 多個通過 "|" 進行串連? ? blueView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;? ?
IOS中級篇 —— Autoresizing