Class ccui.PageView
- Defined in: UIPageView.js
- Extends ccui.ListView
Constructor Attributes | Constructor Name and Description |
---|---|
The PageView control of Cocos UI.
|
Method Summary
Class Detail
ccui.PageView()
The PageView control of Cocos UI.
var pageView = new ccui.PageView(); pageView.setTouchEnabled(true); pageView.addPage(new ccui.Layout()); this.addChild(pageView);
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
-
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)Insert a page into the end of PageView.
- Parameters:
- {ccui.Widget} page
- Page to be inserted.
-
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.
- Deprecated:
- since v3.9, please use 'insertPage(Widget* page, int idx)' instead.
-
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
- Deprecated:
- since v3.9, this is deprecated. Use `getCurrentPageIndex()` instead.
- Returns:
- {number}
-
{number} getCurrentPageIndex()Returns current page index
- Returns:
- {number}
-
getCustomScrollThreshold()Returns user defined scroll page threshold.
- Deprecated:
- Since v3.9, this method always returns 0.
- Since:
- v3.2
-
{string} getDescription()Returns the "class name" of ccui.PageView.
- Returns:
- {string}
-
{boolean} getIndicatorEnabled()Query page indicator state.
- Returns:
- {boolean} True if page indicator is enabled, false otherwise.
-
{cc.Color} getIndicatorIndexNodesColor()Get the color of page indicator's index nodes.
- Returns:
- {cc.Color}
-
{Number} getIndicatorIndexNodesScale()Get the scale of page indicator's index nodes.
- Returns:
- {Number}
-
{cc.Point} getIndicatorPosition()Get the page indicator's position.
- Returns:
- {cc.Point}
-
{cc.Point} getIndicatorPositionAsAnchorPoint()Get the page indicator's position as anchor point.
- Returns:
- {cc.Point}
-
{cc.Color} getIndicatorSelectedIndexColor()Get the color of page indicator's selected index.
- Returns:
- {cc.Color}
-
{number} getIndicatorSpaceBetweenIndexNodes()Get the space between page indicator's index nodes.
- 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}
-
insertPage(page, idx)Insert a page into PageView at a given index.
- Parameters:
- {ccui.Widget} page
- Page to be inserted.
- {number} idx
- A given index.
-
isUsingCustomScrollThreshold()Queries whether we are using user defined scroll page threshold or not
- Deprecated:
- Since v3.9, this method always returns false.
-
removeAllPages()Removes all pages from PageView
-
removePage(page)Removes a page from PageView.
- Parameters:
- {ccui.Widget} page
- Page to be removed.
-
removePageAtIndex(index)Removes a page at index of PageView.
- Parameters:
- {number} index
- A given index.
-
scrollToItem(idx)scroll PageView to index.
- Parameters:
- {number} idx
- A given index in the PageView. Index start from 0 to pageCount -1.
-
scrollToPage(idx)scroll PageView to index.
- Parameters:
- {number} idx
- A given index in the PageView. Index start from 0 to pageCount -1.
-
setCurPageIndex(index)Jump to a page with a given index without scrolling. This is the different between scrollToPage.
- Parameters:
- {number} index
- A given index in PageView. Index start from 0 to pageCount -1.
- Deprecated:
- since v3.9, this is deprecated. Use `setCurrentPageIndex()` instead.
-
setCurrentPageIndex(index)Jump to a page with a given index without scrolling. This is the different between scrollToPage.
- Parameters:
- {number} index
- A given index in PageView. Index start from 0 to pageCount -1.
-
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
- Deprecated:
- Since v3.9, this method has no effect.
- Since:
- v3.2
-
setDirection(direction)Changes scroll direction of ccui.PageView.
- Parameters:
- {ccui.ScrollView.DIR_NONE | ccui.ScrollView.DIR_VERTICAL | ccui.ScrollView.DIR_HORIZONTAL | ccui.ScrollView.DIR_BOTH} direction
-
setIndicatorEnabled(enabled)Toggle page indicator enabled.
- Parameters:
- {boolean} enabled
- True if enable page indicator, false otherwise.
-
setIndicatorIndexNodesColor(color)Set color of page indicator's index nodes.
- Parameters:
- {cc.Color} color
- Color for indicator
-
setIndicatorIndexNodesScale(scale)Set scale of page indicator's index nodes.
- Parameters:
- {Number} scale
- Scale for indicator
-
setIndicatorIndexNodesTexture(texName, texType)Sets texture of indicator index nodes
- Parameters:
- {String} texName
- {ccui.Widget.LOCAL_TEXTURE | ccui.Widget.PLIST_TEXTURE} texType Optional, Default: ccui.Widget.LOCAL_TEXTURE
-
setIndicatorPosition(position)Set the page indicator's position in page view.
- Parameters:
- {cc.Point} position
- The position in page view
-
setIndicatorPositionAsAnchorPoint(positionAsAnchorPoint)Set the page indicator's position using anchor point.
- Parameters:
- {cc.Point} positionAsAnchorPoint
- The position as anchor point.
-
setIndicatorSelectedIndexColor(color)Set color of page indicator's selected index.
- Parameters:
- {cc.Color} color
- Color for indicator
-
setIndicatorSpaceBetweenIndexNodes(spaceBetweenIndexNodes)Set space between page indicator's index nodes.
- Parameters:
- {number} spaceBetweenIndexNodes
- Space between nodes in pixel.
-
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
- Deprecated:
- Since v3.9, this method has no effect.
- Since:
- v3.2