layoutSubviews的触发时机

  • init does not cause layoutSubviews to be called (duh)

init方法不会触发

  • addSubview: causes layoutSubviews to be called on the view being added, the view it’s being added to (target view), and all the subviews of the target

addSubview在目标视图被添加子视图的时候触发

  • view setFrame intelligently calls layoutSubviews on the view having its frame set only if the size parameter of the frame is different

view的frame发生变化的时候触发

  • scrolling a UIScrollView causes layoutSubviews to be called on the scrollView, and its superview

scrollview和它的父视图滚动的时候触发

  • rotating a device only calls layoutSubview on the parent view (the responding viewControllers primary view)

转旋设备的时候,相应的视图控制器对应的主视图会触发

  • Resizing a view will call layoutSubviews on its superview

改变视图大小的时候会在视图的父视图上触发

stackoverflow链接

你可能感兴趣的:(layoutSubviews的触发时机)