自动布局不iOS8上-X $ C $ 6即时更新帧
我用自动布局
在 X $ C $ 6
。
我已经申请了以下限制到滚动视图
。
I have applied the following constraints to a scrollview
.
我试图访问帧此滚动型的 - viewDidLoad中
和 - viewWillAppear中
的iPhone 4Inchs设备方法。这里的问题是,滚动视图的宽度显示登录600。但是当我用我自动布局
的宽度应该是300 4Ichs设备。
好像自动布局
将一定的时间间隔后适用。它显示正确的宽度 - viewDidAppear
方法300
I have tried to access the frame of this scrollview in -viewDidLoad
and -viewWillAppear
methods for iPhone 4Inchs device. Here problem is, the scrollview's width is showing 600 in Log. But the width should be 300 in 4Ichs device as i'm using autolayout
.
Seems autolayout
will apply after some time interval. It is showing correct width in -viewDidAppear
method as 300.
有什么办法来访问原始帧 - viewDidLoad中
和 - viewWillAppear中
方法
Is there any way to access the original frames in -viewDidLoad
and -viewWillAppear
methods ?
先谢谢了。
自动布局不给你正确的帧大小,直到布局传递发生。 viewDidLoad中
是得太早了,把我的头顶部的 willAppear
可能太。 viewDidLayoutSubviews
是正确的地方。
Auto layout doesn't give you the "right" frame sizes until a layout pass has happened. viewDidLoad
is too early, and off the top of my head willAppear
might be too. viewDidLayoutSubviews
is the right place.