Why does my UITableView report itself as 600x600, or what it is in the Storyboard, when I have constraints set?

瘦欲@ 提交于 2019-12-24 03:18:24

问题


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.

The 600x600 is its dimensions within the Any x Any Storyboard grid, but like I said, it should be updating.

Is this a glitch?


回答1:


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.



来源:https://stackoverflow.com/questions/27207644/why-does-my-uitableview-report-itself-as-600x600-or-what-it-is-in-the-storyboar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!