objective-c xcode iOS autoresizingMask 的原理及其使用 - controlView距离 self
作用
如果某个视图设置为
self.controlView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 拼多多帮助力入口
则,该视图相对于父视图的的边距是不变的,可以变化长度和高度
例子
[self.currentPlayerManager.view addSubview:self.controlView];
self.currentPlayerManager.view.frame = superview.bounds;
self.currentPlayerManager.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.controlView.frame = self.currentPlayerManager.view.bounds;
self.controlView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
如上面代码, self.controlView.frame = self.currentPlayerManager.view,表明 self.controlView距离 self.currentPlayerManager.view边距为0,则当self.currentPlayerManager.view的frame改变的时候,self.controlView的frame会变化以保证距离边距固定 如图 改变所示,改变父视图的frame,导致了自身frame的变化
这里的
参考阅读