学习:
layoutSubviews
调用时机
-
addSubview
的时候回调用
*init
的时候不会调用(tableViewCell的init),但是使用initWithFrame的时候如果frame不是CGRectZero的时候会调用 - 滚动
scrollview
的时候会调用 - 旋转屏幕的时候会出发
superview
上的这个layoutSubviews - 改变
subView
的大小的时候会调用superview的layoutSubviews - 改变view的
frame
的时候会调用
苹果官方:You should override this method only if the autoresizing behaviors of the subviews do not offer the behavior you want.
layoutSubviews
方法调用先于drawRect
网友评论