码迷,mamicode.com
首页 > 移动开发 > 详细

IOS中级篇 —— Autoresizing

时间:2015-06-23 15:00:24      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:

?
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

标签:

原文地址:http://www.cnblogs.com/deng1989/p/4595294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!