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
<static> <constant>
ccui.ScrollView.AUTO_SCROLL_MAX_SPEED
The auto scroll max speed of ccui.ScrollView.
{Boolean}
bounceEnabled
- Indicate whether bounce is enabled
<static> <constant>
ccui.ScrollView.DIR_BOTH
The both flag of ccui.ScrollView's direction.
<static> <constant>
ccui.ScrollView.DIR_HORIZONTAL
The horizontal flag of ccui.ScrollView's direction.
<static> <constant>
ccui.ScrollView.DIR_NONE
The none flag of ccui.ScrollView's direction.
<static> <constant>
ccui.ScrollView.DIR_VERTICAL
The vertical flag of ccui.ScrollView's direction.
{ccui.ScrollView.DIR_NONE | ccui.ScrollView.DIR_VERTICAL | ccui.ScrollView.DIR_HORIZONTAL | ccui.ScrollView.DIR_BOTH}
direction
- Scroll direction of the scroll view
<static> <constant>
ccui.ScrollView.EVENT_BOUNCE_BOTTOM
The flag bounce bottom of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_BOUNCE_LEFT
The flag bounce left of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_BOUNCE_RIGHT
The flag bounce right of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_BOUNCE_TOP
The flag bounce top of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM
The flag scroll to bottom of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_SCROLL_TO_LEFT
The flag scroll to left of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_SCROLL_TO_RIGHT
The flag scroll to right of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_SCROLL_TO_TOP
The flag scroll to top of ccui.ScrollView's event.
<static> <constant>
ccui.ScrollView.EVENT_SCROLLING
The scrolling flag of ccui.ScrollView's event.
{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 child to ccui.ScrollView.
- Parameters:
- {cc.Node} widget
- {Number} zOrder Optional
- {Number|string} tag Optional
- tag or name
- Returns:
- {boolean}
-
addEventListener(selector, target)Adds callback function called ScrollView event triggered
- Parameters:
- {Function} selector
- {Object} target Optional
-
addEventListenerScrollView(selector, target)Adds callback function called ScrollView event triggered
- Parameters:
- {Function} selector
- {Object} target Optional
- Deprecated:
- since v3.0, please use addEventListener instead.
-
addNode(node, zOrder, tag)Add node for scrollView
- Parameters:
- {cc.Node} node
- {Number} zOrder
- {Number} tag
- Deprecated:
- since v3.0, please use addChild instead.
-
allocates and initializes a UIScrollView.
- Deprecated:
- since v3.0, please use new ccui.ScrollView() instead.
- Returns:
- {ccui.ScrollView}
-
ctor()Allocates and initializes a UIScrollView. Constructor of ccui.ScrollView. override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
// 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()Returns inner container's children
- Returns:
- {Array}
-
{Number} getChildrenCount()Gets the count of inner container's children
- Returns:
- {Number}
-
{string} getDescription()Returns the "class name" of ccui.ScrollView.
- Returns:
- {string}
-
{ccui.ScrollView.DIR_NONE | ccui.ScrollView.DIR_VERTICAL | ccui.ScrollView.DIR_HORIZONTAL | ccui.ScrollView.DIR_BOTH} getDirection()Returns 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}
-
{cc.Size} getInnerContainerSize()Returns inner container size of ScrollView.
Inner container size must be larger than or equal ScrollView's size.- Returns:
- {cc.Size} inner container size.
-
{ccui.Layout.ABSOLUTE|ccui.Layout.LINEAR_VERTICAL|ccui.Layout.LINEAR_HORIZONTAL|ccui.Layout.RELATIVE} getLayoutType()Returns the layout type of ccui.ScrollView.
-
{cc.Node} getNodeByTag(tag)Returns a node by tag
- Parameters:
- {Number} tag
- Deprecated:
- since v3.0, please use getChildByTag instead.
- Returns:
- {cc.Node}
-
{Array} getNodes()Returns all nodes of inner container
- Deprecated:
- since v3.0, please use getChildren instead.
- Returns:
- {Array}
-
{boolean} init()Initializes a ccui.ScrollView. Please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
- Returns:
- {boolean}
-
interceptTouchEvent(event, sender, touch)Intercept touch event, handle its child's touch event.
- Parameters:
- {number} event
- event type
- {ccui.Widget} sender
- {cc.Touch} touch
-
{boolean} isBounceEnabled()Returns whether bounce is enabled
- Returns:
- {boolean}
-
{boolean} isInertiaScrollEnabled()Returns 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.
-
onEnter()Calls the parent class' onEnter and schedules update function.
-
{boolean} onTouchBegan(touch, event)The touch began event callback handler of ccui.ScrollView.
- Returns:
- {boolean}
-
onTouchCancelled(touch, event)The touch canceled event callback of ccui.ScrollView.
-
onTouchEnded(touch, event)The touch ended event callback handler of ccui.ScrollView.
-
onTouchMoved(touch, event)The touch moved event callback handler of ccui.ScrollView.
-
removeAllChildren()Removes all children.
-
removeAllChildrenWithCleanup(cleanup)Removes all children.
- Parameters:
- {Boolean} cleanup
-
removeAllNodes()Remove all node from ccui.ScrollView.
- Deprecated:
- since v3.0, please use removeAllChildren instead.
-
{boolean} removeChild(child, cleanup)Removes widget child
- Parameters:
- {ccui.Widget} child
- {Boolean} cleanup
- Returns:
- {boolean}
-
removeNode(node)Removes a node from ccui.ScrollView.
- Parameters:
- {cc.Node} node
- Deprecated:
- since v3.0, please use removeChild instead.
-
removeNodeByTag(tag)Removes a node by tag
- Parameters:
- {Number} tag
- Deprecated:
- since v3.0, please use removeChildByTag instead.
-
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)Sets 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)Sets 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 of ccui.ScrollView.
-
update(dt)The update callback handler.
- Parameters:
- {Number} dt