使用pushViewController时,在viewDidLayoutSubviews之前调用viewDidAppear

时间:2015-10-23 07:09:02

标签: ios

遇到问题: 我在xib中使用自动布局查看控制器A设置,并通过pushViewController从主视图控制器推送。主视图控制器嵌入在导航控制器中。

我尝试使用pushViewController,推送视图控制器B,同一个类的另一个实例为A,

但我发现,即使在viewDidAppearviewWillLayoutSubviews

之前,也会在B中调用viewDidLayoutSubviews

因此,当我试图在viewDidAppear中获取子视图的帧时,它是不正确的。怎么了?

一些痕迹:

2015-10-23 15:02:25.277 Compass[8199:1698308] -[BarLineChartViewController viewWillAppear:] line 89 $ axis chart VC will appear
2015-10-23 15:02:25.286 Compass[8199:1698308] -[BarLineChartViewController viewDidAppear:] line 106 $ axis chart VC did appear
2015-10-23 15:02:25.293 Compass[8199:1698308] -[ChartViewController viewDidAppear:] line 126 $ chart vc viewDidAppear
2015-10-23 15:02:25.298 Compass[8199:1698308] -[BarLineChartViewController viewWillLayoutSubviews] line 95 $ axis chart VC will LayoutSubviews
2015-10-23 15:02:25.303 Compass[8199:1698308] -[BarLineChartViewController viewWillLayoutSubviews] line 95 $ axis chart VC will LayoutSubviews
2015-10-23 15:02:25.310 Compass[8199:1698308] -[BarLineChartViewController viewDidLayoutSubviews] line 100 $ axis chart VC did LayoutSubviews

0 个答案:

没有答案