Mac Dev Part 6 - ContainerView &

2019-03-06  本文已影响0人  遇见Miu

时间是挤出来的

感觉需要加快点脚步才行呀,时间感觉总是不够用

1.ContainerView的创建

ContainerView感觉类似于iOS中的childVieewController,拖入SB中会自带一个viewController

效果:


ContainerView.jpg

2.NSViewController生命周期

感觉和iOS的基本上没有区别

viewDidLoad视图加载完毕

viewWillAppear视图即将显示

viewWillLayout视图即将布局

viewDidLayout视图布局完毕

viewDidAppear视图显示完毕

此处的viewWillLayout文档是这样解释的

You can override this method to perform tasks to precede the layout of the view controller’s view, such as adjusting Auto Layout constraints. If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.

The default implementation of this method does nothing.

重写此方法,执行视图控制器视图布局之前的任务,可以调整自动布局约束

此处的viewDidLayout文档是这样解释的

You can override this method to perform tasks to follow the completion of layout of the view controller’s view. If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.

The default implementation of this method does nothing.
上一篇下一篇

猜你喜欢

热点阅读