page.addPage(direction)

Add a new page to the page.content layer of the PageComponent. It takes two arguments: a layer (page) and a direction ("right" or "bottom").
译:添加一个新页的pagecomponent的page.content层。它需要两个参数:一层(page)和一个方向(“右”或“底部”)。

page = new PageComponent
    width: Screen.width
    height: Screen.height

# The first page, placed directly within the page.content 
pageOne = new Layer
    width: page.width
    height: page.height
    parent: page.content
    backgroundColor: "#28affa"

# Second page 
pageTwo = new Layer
    width: page.width
    height: page.height
    backgroundColor: "#90D7FF"

# Third page 
pageThree = new Layer
    width: page.width
    height: page.height
    backgroundColor: "#CAECFF"


# Add the second and third page to the right 
page.addPage(pageTwo, "right")
page.addPage(pageThree, "right")

If you're looking to add pages to the left, you can initially add them to the right, and instantly switch to a different page, using snapToPage().
译:如果你在左边添加页面,你可以先将它们添加到右边,瞬间切换到一个不同的页面,使用snaptopage()。

page = new PageComponent
    width: Screen.width
    height: Screen.height

pageOne = new Layer
    width: page.width
    height: page.height
    parent: page.content
    backgroundColor: "#28affa"

pageTwo = new Layer
    width: page.width
    height: page.height
    backgroundColor: "#90D7FF"

# Add a page to the right 
page.addPage(pageTwo, "right")

# Start at the second page by default 
page.snapToPage(pageTwo, false)

results matching ""

    No results matching ""