什么时候调用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>>
答案 0 :(得分:1)
UILayoutGuide
是一个私人Apple课程。
UILayoutGuide
通常被称为-topLayoutGuide
和-bottonLayoutGuide
,这些不是真正的约束。