Something like autolayout or constraints

464 views Asked by At

I just started using SpriteBuilder and was wondering if something like “autolayout” (in a basic form) was possible for the apps? You see I have made this simple layout ( http://cl.ly/Szs3 ) containing a header (blue-ish) and body (red).

Now what I want is that the header has a fixed height (it has 100% percent width, so that goes wel) and the red block “fills” the rest of the screen. So when the device is a taller device more content at once can be shown.

Is this possible? And if so, how could I acchieve this.

2

There are 2 answers

0
Ben-G On BEST ANSWER

Yes there is such an option, yet the naming is a little bit different.

I uploaded my example project to this GitHub Repo: https://github.com/MakeGamesWithUs/Spritebuilder-Simple-Autosizing

Your top container needs a static height, and a relative position and a Y Anchor Point of 1. This way the top container always has a size of 100 points and is always positioned at the top of the screen: enter image description here

Your bottom container needs a height inset of 100, this means your container will use the complete height of the parent container, except for 100 points at the top:

enter image description here

0
yoAlex5 On

You can take a look at: