imageRectForContentRect,titleRectForContentRect,contentRectForBounds,imageRectForContentRect什么时候调用,contenttitle
投稿于 被查看 41726 次 评论:105
imageRectForContentRect,titleRectForContentRect,contentRectForBounds,imageRectForContentRect什么时候调用,contenttitle
UIButton的布局顺序细节
什么时候调用imageRectForContentRect,titleRectForContentRect,contentRectForBounds,imageRectForContentRect,也是调用时机。首先梳理清楚几个布局的规则:
记住这几个布局时的调用顺序:
特别的:
- 在UIButton初始化阶段会依次调用contentRectForBounds:,imageRectForContentRect:。这是在布局之前完成的。
- 改变title,image,background image都会来到进行绿色文字顺序的布局。但不会触发父视图的布局,因为UIButton的尺寸未变。
- 绿色文字区域的调用并不是一次完成。而是复杂的多次调用完成的。它的顺序是:3 -> 4 -> 3 -> 5 -> 3 -> 4
转注出:https://www.cnblogs.com/xiaobajiu/p/11774496.html
相关文章
- 暂无相关文章
用户评论