Game Development Reference
In-Depth Information
Figure 8-2
.
The Scroll View's properties
The
Scroll View
node should scroll only horizontally; therefore, uncheck
Vertical scroll
enabled
. The
Bounces
setting determines the behavior at the edges. That is, if you try to
scroll left on the first page, or right on the last page, with
Bounces
checked, you can drag
the
Content
node slightly in that direction, but it will keep bouncing back. With
Bounces
disabled, dragging left on the first page or right on the last page simply has no effect.
Bouncing is helpful to indicate the borders of the scrolling content to the user. Last,
Pa-
ging enabled
will scroll and snap each page in place. Without paging, you can scroll
through the
Content
node without any kind of snapping.
On the
Item Code Connection
tab, you should also assign a Doc root var. Enter
_levelSelectScrollView
in the corresponding field.
Due to the margin, the images are left-aligned with the margin extending entirely to the
right, as you can see in
Figure 8-3
.
Usually, this isn't a problem since it allows you to see
more of the page to the right, encouraging the user to swipe. It also shows more clear
space to the right when you reach the last page. However, sometimes it's more important
to center the
Scroll View
pages on the stage despite the margin. To combat the 30-point
margin in this case, you would have to add another 15 points to the
Scroll View
's X posi-
tion. To do that, change the
Scroll View
's X position type to points, enter
299
(284 plus
15), and then change the position type back to %. You'll get an X position of 52.6%, and
the pages are centered on the screen. I'll leave it up to you whether you prefer the pages
centered or not.
Search WWH ::
Custom Search