iOS的layout机制相关方法
来源:互联网 发布:出境旅游数据 编辑:程序博客网 时间:2024/06/05 11:11
- (CGSize)sizeThatFits:(CGSize)size { return CGSizeMake(100, 100); //Asks the view to calculate //and return the size that best fits the specified size.}//sizeToFit会自动调用sizeThatFits方法;- (void)sizeToFit { //You should not override this method. //If you want to change the default sizing information for your view, //override the sizeThatFits: instead. }//1.init初始化不会触发layoutSubviews//2.用initWithFrame 进行初始化时(rect不能为0)或者改变frame会触发//3.addSubview会触发//4.滚动ScrollView也会触发//5.旋转Screen会触发superView上的layoutSubviews事件//6.改变一个View的大小的时候也会触发superView上的layoutSubviews事件- (void)layoutSubviews {//Lays out subviews.//You should override this method only if the autoresizing and constraint-based behaviors of the subviews do not offer the behavior you want.// You can use your implementation to set the frame rectangles of your subviews directly.//You should not call this method directly. //If you want to force a layout update, call the setNeedsLayout method instead to do so prior to the next drawing update. //If you want to update the layout of your views immediately, call the layoutIfNeeded method.}- (void)layoutIfNeeded {//Lays out the subviews immediately.//Use this method to force the layout of subviews before drawing.}- (void)setNeedsLayout {}- (void)setNeedsDisplay {//You can use this method or the setNeedsDisplayInRect: //to notify the system that your view’s contents need to be redrawn}- (void)setNeedsDisplayInRect:(CGRect)rect {}- (void)drawRect:(CGRect)rect {//Only override drawRect://if you perform custom drawing. }- (void)viewWillLayoutSubviews {//Called to notify the view controller that its view is about to layout its subviews.}- (void)viewDidLayoutSubviews {//Your view controller can override this method to make changes //after the view lays out its subviews. }
0 0
- iOS的layout机制相关方法
- ios layout机制相关方法
- ios layout机制相关方法
- IOS: layout机制相关方法
- ios layout机制相关方法
- ios layout机制相关方法
- ios layout机制相关方法
- ios layout机制相关方法
- ios layout机制相关方法
- iOS layout机制相关方法
- ios layout机制相关方法
- iOS layout机制相关方法
- iOS layout机制相关方法
- iOS (布局机制)layout机制相关方法
- ios layoutSubviews 及 layout机制相关方法
- iOS layout的相关方法
- layout机制相关方法
- iOS学习之——layout机制相关方法
- 对于【包】的理解。-转自百度百科
- 根据字符串的长度得到其在屏幕上的px值
- 如何绕过检测在电脑上观看手机影片
- Android Support Library
- Android Studio 遇到的错误、异常和总结
- iOS的layout机制相关方法
- treap模版
- Mybatis框架
- activity window 获取setContentView的基视图(getContentView)
- Docker安装nginx
- 找工作——jvm复习(一)
- HDU 1509 windows message queue
- 电子工程师最关心的10个问题,看完有答案没?
- ubuntu 安装qt4