I am building a iOS-app style UI where the layout needs to be responsive and stretch to fill the entire screen. It consists of a static top bar and then a series of pages below, which users swipe between. Only one page can fill the screen at a time.
The solution I'm considering is to have a horizontal scroll view that contain the pages. Currently I only have one page, but when I add more then each page will need to be contained inside and arranged by a UIGrid.
The scroll view is constantly anchored to the camera size; that's great and works perfectly.
The child object of the scroll view is an invisible widget (Page Container), which I stretch to fill the space underneath the top bar using anchors. The page elements for each page are child objects to each container, and are either anchored to each other or to the container edges.
So, the hierarchy is:
UI Root
--Camera
----TopBar (Panel) [Left and Right edges anchored to Camera Left & Right edges]
----ScrollView (Panel) [All edges anchored to corresponding Camera edges]
------PageContainer (Invisible Widget) [Left, Right, and Bottom edges anchored to Camera edges, Top edge anchored to Bottom edge of a TopBar sprite]
--------PageElement (Sprite) [Anchors for page elements are dependent on the PageContainer dimensions]
--------PageElement (Sprite)
--------etc.
This makes the UI properly scale to fit my target screen sizes. However, if the Page Container's anchor is active at runtime, it obviously conflicts with the scroll view. This is the same problem described above when they were trying to tween objects that are anchored.
Setting the Anchor on the PageContainer to None after Start () will probably work. I'll see about doing that now and report back.
What do you think of this use case, Aren? Perhaps there's a better solution for this type of system?