Class ccui.ScrollView
- Defined in: UIScrollView.js
- Extends ccui.Layout
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
The ScrollView control of Cocos UI
|
Method Summary
Class Detail
ccui.ScrollView()
The ScrollView control of Cocos UI
Field Detail
{Boolean}
bounceEnabled
- Indicate whether bounce is enabled
{ccui.ScrollView.DIR_NONE | ccui.ScrollView.DIR_VERTICAL | ccui.ScrollView.DIR_HORIZONTAL | ccui.ScrollView.DIR_BOTH}
direction
- Scroll direction of the scroll view
{Boolean}
inertiaScrollEnabled
- Indicate whether inertiaScroll is enabled
{Number}
innerHeight
- Inner container height of the scroll view
{Number}
innerWidth
- Inner container width of the scroll view
Method Detail
-
{boolean} addChild(widget, zOrder, tag)Add widget
- Parameters:
- {cc.Node} widget
- {Number} zOrder Optional
- {Number|string} tag Optional
- tag or name
- Returns:
- {boolean}
-
addEventListenerScrollView(selector, target)Add call back function called ScrollView event triggered
- Parameters:
- {Function} selector
- {Object} target
-
addNode(node, zOrder, tag)Add node for scrollView
- Parameters:
- {cc.Node} node
- {Number} zOrder
- {Number} tag
-
allocates and initializes a UIScrollView.
// example var uiScrollView = ccui.ScrollView.create();
- Returns:
- {ccui.ScrollView}
-
ctor()allocates and initializes a UIScrollView. Constructor of ccui.ScrollView
// example var uiScrollView = new ccui.ScrollView();
-
{ccui.Widget} findNextFocusedWidget(direction, current)When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.
If the widget is not in a layout, it will return itself- Parameters:
- {Number} direction
- the direction to look for the next focused widget in a layout
- {ccui.Widget} current
- the current focused widget
- Returns:
- {ccui.Widget}
-
{ccui.Widget} getChildByName(name)Gets a child from the container given its name
- Parameters:
- {String} name
- Returns:
- {ccui.Widget}
-
{ccui.Widget} getChildByTag(tag)Gets a child from the container given its tag
- Parameters:
- {Number} tag
- Returns:
- {ccui.Widget}
-
{Array} getChildren()get inner container's children
- Returns:
- {Array}
-
{Number} getChildrenCount()get the count of inner container's children
- Returns:
- {Number}
-
{string} getDescription()Returns the "class name" of widget.
- Returns:
- {string}
-
{ccui.ScrollView.DIR_NONE | ccui.ScrollView.DIR_VERTICAL | ccui.ScrollView.DIR_HORIZONTAL | ccui.ScrollView.DIR_BOTH} getDirection()Gets scroll direction of ScrollView.
- Returns:
- {ccui.ScrollView.DIR_NONE | ccui.ScrollView.DIR_VERTICAL | ccui.ScrollView.DIR_HORIZONTAL | ccui.ScrollView.DIR_BOTH}
-
{ccui.Layout} getInnerContainer()Gets inner container of ScrollView. Inner container is the container of ScrollView's children.
- Returns:
- {ccui.Layout}
-
getInnerContainerSize()Gets inner container size of ScrollView.
Inner container size must be larger than or equal ScrollView's size.- Returns:
- inner container size.
-
{ccui.Layout.ABSOLUTE|ccui.Layout.LINEAR_VERTICAL|ccui.Layout.LINEAR_HORIZONTAL|ccui.Layout.RELATIVE} getLayoutType()Gets LayoutType.
- Returns:
- {ccui.Layout.ABSOLUTE|ccui.Layout.LINEAR_VERTICAL|ccui.Layout.LINEAR_HORIZONTAL|ccui.Layout.RELATIVE}
-
{cc.Node} getNodeByTag(tag)Get node by tag
- Parameters:
- {Number} tag
- Returns:
- {cc.Node}
-
{Array} getNodes()Get all nodes of inner container
- Returns:
- {Array}
-
interceptTouchEvent(event, sender, touch)Intercept touch event
- Parameters:
- {number} event
- event type
- {ccui.Widget} sender
- {cc.Touch} touch
-
{boolean} isBounceEnabled()get whether bounce is enabled
- Returns:
- {boolean}
-
{boolean} isInertiaScrollEnabled()get whether inertiaScroll is enabled
- Returns:
- {boolean}
-
jumpToBottom()Move inner container to bottom boundary of ScrollView.
-
jumpToBottomLeft()Move inner container to bottom and left boundary of ScrollView.
-
jumpToBottomRight()Move inner container to bottom and right boundary of ScrollView.
-
jumpToLeft()Move inner container to left boundary of ScrollView.
-
jumpToPercentBothDirection(percent)Move inner container to both direction percent position of ScrollView.
- Parameters:
- {cc.Point} percent
- The destination vertical percent, accept value between 0 - 100
-
jumpToPercentHorizontal(percent)Move inner container to horizontal percent position of ScrollView.
- Parameters:
- {Number} percent
- The destination vertical percent, accept value between 0 - 100
-
jumpToPercentVertical(percent)Move inner container to vertical percent position of ScrollView.
- Parameters:
- {Number} percent
- The destination vertical percent, accept value between 0 - 100
-
jumpToRight()Move inner container to right boundary of ScrollView.
-
jumpToTop()Move inner container to top boundary of ScrollView.
-
jumpToTopLeft()Move inner container to top and left boundary of ScrollView.
-
jumpToTopRight()Move inner container to top and right boundary of ScrollView.
-
removeAllNodes()Remove all node
-
{boolean} removeChild(child, cleanup)remove widget child override
- Parameters:
- {ccui.Widget} child
- {Boolean} cleanup
- Returns:
- {boolean}
-
removeNode(node)Remove a node
- Parameters:
- {cc.Node} node
-
removeNodeByTag(tag)Remove a node by tag
- Parameters:
- {Number} tag
-
scrollToBottom(time, attenuated)Scroll inner container to bottom boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
scrollToBottomLeft(time, attenuated)Scroll inner container to bottom and left boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
scrollToBottomRight(time, attenuated)Scroll inner container to bottom and right boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
scrollToLeft(time, attenuated)Scroll inner container to left boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
scrollToPercentBothDirection(percent, time, attenuated)Scroll inner container to both direction percent position of ScrollView.
- Parameters:
- {cc.Point} percent
- {Number} time
- {Boolean} attenuated
-
scrollToPercentHorizontal(percent, time, attenuated)Scroll inner container to horizontal percent position of ScrollView.
- Parameters:
- {Number} percent
- {Number} time
- {Boolean} attenuated
-
scrollToPercentVertical(percent, time, attenuated)Scroll inner container to vertical percent position of ScrollView.
- Parameters:
- {Number} percent
- {Number} time
- {Boolean} attenuated
-
scrollToRight(time, attenuated)Scroll inner container to right boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
scrollToTop(time, attenuated)Scroll inner container to top boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
scrollToTopLeft(time, attenuated)Scroll inner container to top and left boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
scrollToTopRight(time, attenuated)Scroll inner container to top and right boundary of ScrollView.
- Parameters:
- {Number} time
- {Boolean} attenuated
-
setBounceEnabled(enabled)set bounce enabled
- Parameters:
- {Boolean} enabled
-
setDirection(dir)Changes scroll direction of ScrollView.
- Parameters:
- {ccui.ScrollView.DIR_NONE | ccui.ScrollView.DIR_VERTICAL | ccui.ScrollView.DIR_HORIZONTAL | ccui.ScrollView.DIR_BOTH} dir
- Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll
-
setInertiaScrollEnabled(enabled)set inertiaScroll enabled
- Parameters:
- {boolean} enabled
-
setInnerContainerSize(size)Changes inner container size of ScrollView.
Inner container size must be larger than or equal the size of ScrollView.- Parameters:
- {cc.Size} size
- inner container size.
-
setLayoutType(type)Sets LayoutType.
- Parameters:
- {ccui.Layout.ABSOLUTE|ccui.Layout.LINEAR_VERTICAL|ccui.Layout.LINEAR_HORIZONTAL|ccui.Layout.RELATIVE} type