首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

layoutSubviews几时被调用

2014-01-06 
layoutSubviews何时被调用It’s important to optimize any UIView layoutSubviews method you create, as

layoutSubviews何时被调用

It’s important to optimize any UIView layoutSubviews method you create, as it can be frequently called, and has the potential for creating recursion (triggering a setNeedsLayout from layoutSubviews can create a loop that will grossly affect your apps performance). Layout subviews is called once per run loop on any view that has had setNeedsLayout or setNeedsDisplayWithRect: called on it. So in addition to any time you manually call these methods, it can be useful to know when the UI framework calls setNeedsLayout/setNeedsDisplay as this will trigger layoutSubviews.

?

1、frame有变化会调用

2、addSubview会调用过

3、旋转screen会调用

4、滚动一个UIScrollView会调用

5、子view大小有变化时,supreview也会调用

?

热点排行