什么时候调用UIView.didAddSubview?

时间:2014-10-16 01:19:57

标签: ios xcode uiview

什么时候调用UIView.didAddSubview?

我创建了一个简单的View和ViewController应用程序 当我运行此应用程序时,第一次出现View时,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>>

1 个答案:

答案 0 :(得分:1)

UILayoutGuide是一个私人Apple课程。

UILayoutGuide通常被称为-topLayoutGuide-bottonLayoutGuide,这些不是真正的约束。

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