UIView.didAddSubview何时调用?

我创建了一个简单的View和ViewController应用程序。
当我运行此应用程序时,第一次出现“视图”时,didAddSubview被调用了两次。
https://github.com/toshi0383/HelloUIView

以下是日志输出

didAddSubView
  <_UILayoutGuide: 0x7f92d3425210; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x7f92d3419cf0>>
didAddSubView
  <_UILayoutGuide: 0x7f92d3425c10; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x7f92d34244a0>>
viewDidLoad
  [<_UILayoutGuide: 0x7f92d3425210; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x7f92d3419cf0>>, <_UILayoutGuide: 0x7f92d3425c10; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x7f92d34244a0>>]
didMoveToWindow
didMoveToSuperView
layoutSubviews
  <ViewTest.View: 0x7f92d3424bc0; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x7f92d3423320>>

最佳答案

UILayoutGuide是Apple的私有课程。

通常将UILayoutGuide称为-topLayoutGuide-bottonLayoutGuide,它们并不是真正的约束。

同样的问题在这里:
stack overflow : what-is-uilayoutguide

10-04 12:58