IOS中级篇 —— Autoresizing

?

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;

? ?

时间: 2024-08-09 02:59:37

IOS中级篇 —— Autoresizing的相关文章

IOS中级篇—— 多线程--NSOperation

NSOperation 操作? 任务是对代码的封装, 操作是对任务的封装 --目的:就是可以随时的暂停/恢复/取消任务; NSOperation 对GCD的封装. OC 运用起来更加方便. 抽象类. 车 NSOperation的使用: <1> 操作直接调用 start方法,就是在当前线程执行(Block中封装的任务数大于1的情况除外). <2> 就是将操作放在队列中.自动的帮我们开启线程,来执行操作. 两个子类: NSInvocationOperation: 调用 ? ? ? 1.

IOS——中级篇 --TableView以及Cell

????? //? 设置tableView的行高 ??? self.tableView.rowHeight = 100;//? 设置tableView分割线的样式//? UITableViewCellSeparatorStyleNone 不显示分割线//? UITableViewCellSeparatorStyleSingleLine? 显示分割线(默认) ??? self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingl

IOS中级篇 —— 多线程 - GCD

GCD 是c语言的框架,不需要手动管理内存 是一个面向任务   不是面向线程,不需要管理线程的生命周期 GCD 任务/队列 执行函数 任务:Block  任务都封闭在Block中.  —— 线程执行 队列:存放任务    FIFO (先进先出的原则) GCD中的队列: 串行队列:想要任务按顺序执行 //    创建一个串行队列 dispatch_queue_t serialQueue = dispatch_queue_create("serial", DISPATCH_QUEUE_SE

IOS中级篇 —— 日期时间对象

结合NSCalendar和NSDate能做更多的日期\时间处理 获得NSCalendar对象 NSCalendar *calendar = [NSCalendar currentCalendar];?获得年月日 - (NSDateComponents *)components:(NSCalendarUnit)unitFlags fromDate:(NSDate *)date; //创建日期 NSDate?*d = [NSDate?date]; //创建日期对象 NSCalendar?*ca =

IOS中级篇——何时使用copy,strong,weak,assign关键字 定义属性

? 父类指针可以指向子类对象 ? //定义block别名. typedef void (^LYItemOption)(); @interface LYItemArrow : LYItem@property(nonatomic,strong) Class desController; @property(nonatomic,copy) LYItemOption option; ? ? 1.strong :除NSString\block以外的OC对象 ? @property(nonatomic,st

IOS中级篇 —— 关于深复制和浅复制

?深复制(深拷贝,内容拷贝,deep?copy) ?源对象和副本对象是不同的两个对象 ?源对象引用计数器不变,?副本对象计数器为1(因为是新产生的) ?本质是:产生了新的对象 ? ?浅复制(浅拷贝,指针拷贝,shallow?copy) ?源对象和副本对象是同一个对象 ?源对象(副本对象)引用计数器?+?1,?相当于做一次retain操作 ?本质是:没有产生新的对象

IOS中级篇 —— 手动内存管理

retainCount?? //dealloc方法,是对象的临终遗言的方法 //对象被销毁的时候,会默认的调用该方法 //注意:dealloc 方法是系统根据引用计数器的值,自动调用的, 野指针 内存泄露 @property??参数 @class 使用 循环retain解决方法 自动释放池?? @autoreleasepool

IOS中级篇 —— NSFileManager常用方法

[fileManager isDeletableFileAtPath:<#(NSString *)#>]; 判断一个路径是否可删除 [fileManager isWritableFileAtPath:<#(NSString *)#>];??判断一个路径是否可写 [fileManager isReadableFileAtPath:<#(NSString *)#>];??判断一个路径是否可读 [fileManager fileExistsAtPath:<#(NSStr

IOS中级篇 —— 字典转模型

@property (nonatomic, copy) NSString *icon;@property (nonatomic, copy) NSString *name; -(instancetype) initWithDic:(NSDictionary *)dic; +(instancetype) appViewWithDic:(NSDictionary *)dic; -(instancetype)initWithDic:(NSDictionary *)dic{ ?? if ([super