Xcode 8 Storyboard frame sizes issue

111 Views Asked by At

I put UIView onto a ViewController's view using NavigationController.

And set the new UIView's constraints as Top Space to TopLayoutGuide:0, Leading space to superview:0 Trailing space to superview:0 and Bottom Space to Bottom LayoutGuide:0.

As a result, in IB, the new UIView seems fine, I mean it's top is just under the Navigation Bar and fill the rest.

But, in Objective-C, I output the NSLog for self.view.frame.size and the new UIView's frame.size. I expected that the height of new UIView was smaller than self.view's height As the new UIView's top is from just under the Navigation Bar while self.view cover's all area.

But the result was same height for both of them. And this makes the contents on new UIView are misplaced.

Do you have any good solution?

Thank you.

1

There are 1 best solutions below

0
Masaru Kitajima On

Writing codes on viewDidLauoutSubviews solved the problem.