为什么我的UITableView报告自己为600x600,或者当我有约束设置它是什么在故事板中? [英] Why does my UITableView report itself as 600x600, or what it is in the Storyboard, when I have constraints set?
问题描述
我的 UITableView
,当我在调试器中的 po
框架时,报告其宽度和高度为600x600。我把它固定在它的视图控制器的两侧,所以我不明白为什么会报告这个。
My UITableView
, when I po
the frame in the debugger, reports its width and height as 600x600. I have it pinned to the sides of its view controller, so I don't understand why it would be reporting this.
600x600的尺寸在任何
x 任何
故事板网格,但就像我说,应该更新。
The 600x600 is its dimensions within the Any
x Any
Storyboard grid, but like I said, it should be updating.
这是一个小故障吗?
推荐答案
它会报告600x600尺寸,直到布局完成。如果您重写 viewDidLayoutSubviews
方法并在其中插入断点:
It will report 600x600 dimensions until its layout is complete. If you override viewDidLayoutSubviews
method and put a breakpoint there:
- (void) viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
//
// NSLog frame here
}
将获得适当的框架大小。
You will get proper frame size.
这篇关于为什么我的UITableView报告自己为600x600,或者当我有约束设置它是什么在故事板中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!