문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top