首页 > 其他 > 详细

layoutSubviews的缺省实现是使用约束进行布局

时间:2019-05-21 16:55:55      阅读:128      评论:0      收藏:0      [点我收藏+]

Discussion

The default implementation of this method does nothing on iOS 5.1 and earlier. Otherwise, the default implementation uses any constraints you have set to determine the size and position of any subviews.

Subclasses can override this method as needed to perform more precise layout of their 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.

 

结论:任何视图尺寸的变更最终都是通过layoutSubviews实现的。

layoutSubviews的缺省实现是使用约束进行布局

原文:https://www.cnblogs.com/feng9exe/p/10900374.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!