Search code examples
swiftxcode-storyboard

fill rest of view in storyboard


How do i achieve the following layout within a storyboard? I have seen related answers in SO suggesting a code solution. But can it be done codeless?

enter image description here


Solution

  • For your toolbar at the top set the left, right, and top spacing constraints with a constant of 0, then set a height constraint with a constant of whatever your fixed height is.

    For the bottom container view, set the left, right, and bottom spacing constraints with a constant of 0, and set a vertical spacing constraint to the toolbar, also with a constant of 0.

    This will anchor the toolbar to the top and automatically fill the rest of your view controller with the container view.