Class ccui.PageView

Class Summary
Constructor Attributes Constructor Name and Description
 
The PageView control of Cocos UI.

Method Summary

Class Detail

ccui.PageView()
The PageView control of Cocos UI.

Field Detail

<static> <constant> ccui.PageView.DIRECTION_LEFT
The right flag of ccui.PageView's auto scroll direction.
<static> <constant> ccui.PageView.DIRECTION_RIGHT
The right flag of ccui.PageView's auto scroll direction.
<static> <constant> ccui.PageView.EVENT_TURNING
The turning flag of ccui.PageView's event.
<static> <constant> ccui.PageView.TOUCH_DIR_LEFT
The left flag of ccui.PageView's touch direction.
<static> <constant> ccui.PageView.TOUCH_DIR_RIGHT
The right flag of ccui.PageView's touch direction.

Method Detail

  • addEventListener(selector, target)
    Adds event listener to ccui.PageView.
    Parameters:
    {Function} selector
    {Object} target Optional
  • addEventListenerPageView(selector, target)
    Adds event listener to ccui.PageView.
    Parameters:
    {Function} selector
    {Object} target Optional
    Deprecated:
    since v3.0, please use addEventListener instead.
  • addPage(page)
    Adds a page to ccui.PageView.
    Parameters:
    {ccui.Layout} page
  • addWidgetToPage(widget, pageIdx, forceCreate)
    Add a widget to a page of PageView.
    Parameters:
    {ccui.Widget} widget
    widget to be added to PageView.
    {number} pageIdx
    index of page.
    {Boolean} forceCreate
    if force create and there is no page exist, PageView would create a default page for adding widget.
  • <static> {ccui.PageView} ccui.PageView.create()
    allocates and initializes a UIPageView.
    Deprecated:
    since v3.0, please use new ccui.PageView() instead.
    Returns:
    {ccui.PageView}
  • ctor()
    Allocates and initializes a UIPageView. Constructor of ccui.PageView. please do not call this function by yourself, you should pass the parameters to constructor to initialize it
.
    // example
    var uiPageView = new ccui.PageView();
  • {number} getCurPageIndex()
    Returns current page index
    Returns:
    {number}
  • getCustomScrollThreshold()
    Returns user defined scroll page threshold.
    Since:
    v3.2
  • {string} getDescription()
    Returns the "class name" of ccui.PageView.
    Returns:
    {string}
  • {number} getLayoutType()
    Returns the layout type of ccui.PageView. it's always ccui.Layout.ABSOLUTE.
    Returns:
    {number}
  • {ccui.Layout} getPage(index)
    Returns a page from PageView by index
    Parameters:
    {Number} index
    Returns:
    {ccui.Layout}
  • {Array} getPages()
    Returns all pages of PageView
    Returns:
    {Array}
  • {boolean} init()
    Initializes a ccui.PageView. Please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
    Returns:
    {boolean}
  • insertPage(page, idx)
    Inserts a page in the specified location.
    Parameters:
    {ccui.Layout} page
    page to be added to PageView.
    {Number} idx
    index
  • interceptTouchEvent(eventType, sender, touch)
    Intercept touch event, handle its child's touch event.
    Parameters:
    {Number} eventType
    event type
    {ccui.Widget} sender
    {cc.Touch} touch
  • isUsingCustomScrollThreshold()
    Queries whether we are using user defined scroll page threshold or not
  • onEnter()
    Calls the parent class' onEnter and schedules update function.
  • onTouchCancelled(touch, event)
    The touch canceled event callback handler of ccui.PageView.
    Parameters:
    {cc.Touch} touch
    {cc.Event} event
  • onTouchEnded(touch, event)
    The touch ended event callback handler of ccui.PageView.
    Parameters:
    {cc.Touch} touch
    {cc.Event} event
  • onTouchMoved(touch, event)
    The touch moved event callback handler of ccui.PageView.
    Parameters:
    {cc.Touch} touch
    {cc.Event} event
  • removeAllPages()
    Removes all pages from PageView
  • removePage(page)
    Removes a page from PageView.
    Parameters:
    {ccui.Layout} page
  • removePageAtIndex(index)
    Removes a page at index of PageView.
    Parameters:
    {number} index
  • scrollToPage(idx)
    scroll PageView to index.
    Parameters:
    {number} idx
    index of page.
  • setCustomScrollThreshold(threshold)
    Set custom scroll threshold to page view. If you don't specify the value, the pageView will scroll when half page view width reached.
    Parameters:
    threshold
    Since:
    v3.2
  • setLayoutType(type)
    Does nothing. ccui.PageView's layout type is ccui.Layout.ABSOLUTE.
    Parameters:
    {Number} type
  • setUsingCustomScrollThreshold(flag)
    Set using user defined scroll page threshold or not. If you set it to false, then the default scroll threshold is pageView.width / 2.
    Parameters:
    flag
    Since:
    v3.2
  • update(dt)
    Called once per frame. Time is the number of seconds of a frame interval.
    Parameters:
    {Number} dt