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
<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_AUTOSCROLL_ENDED
The flag autoscroll ended of ccui.ScrollView's event.
<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_CONTAINER_MOVED
The flag container moved 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
{Number}
touchTotalTimeThreshold
- Touch total time threshold
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)Adds callback function called ScrollView event triggered
- Parameters:
- {Function} selector
-
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}
-
getInnerContainerPosition()Get inner container position
- Returns:
- The inner container position.
-
{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}
-
{number} getScrollBarAutoHideTime()Get the scroll bar's auto hide time
- Returns:
- {number}
-
{cc.Color} getScrollBarColor()Get the scroll bar's color
- Returns:
- {cc.Color} the scroll bar's color
-
{number} getScrollBarOpacity()Get the scroll bar's opacity
- Returns:
- {number}
-
{cc.Point} getScrollBarPositionFromCornerForHorizontal()Get the horizontal scroll bar's position from right-top corner.
- Returns:
- {cc.Point}
-
{cc.Point} getScrollBarPositionFromCornerForVertical()Get the vertical scroll bar's position from right-top corner.
- Returns:
- {cc.Point}
-
{number} getScrollBarWidth()Get the scroll bar's width
- Returns:
- {number} the scroll bar's width
-
{Number} getTouchTotalTimeThreshold()Get the touch total time threshold
- Returns:
- {Number}
-
{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}
-
{boolean} isScrollBarAutoHideEnabled()Query scroll bar auto hide state
- Returns:
- {boolean}
-
{boolean} isScrollBarEnabled()Query scroll bar state.
- Returns:
- {boolean} True if scroll bar is enabled, false otherwise.
-
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
-
setInnerContainerPosition(position)Set inner container position
- Parameters:
- {cc.Point} position
- Inner container position.
-
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.
-
setScrollBarAutoHideEnabled(autoHideEnabled)Set scroll bar auto hide state
- Parameters:
- {boolean} autoHideEnabled
- scroll bar auto hide state
-
setScrollBarAutoHideTime(autoHideTime)Set scroll bar auto hide time
- Parameters:
- {number} autoHideTime
- scroll bar auto hide state
-
setScrollBarColor(color)Set the scroll bar's color
- Parameters:
- {cc.Color} color
- the scroll bar's color
-
setScrollBarEnabled(enabled)Toggle scroll bar enabled.
- Parameters:
- {boolean} enabled
- True if enable scroll bar, false otherwise.
-
setScrollBarOpacity(opacity)Set the scroll bar's opacity
- Parameters:
- {number} opacity
- the scroll bar's opacity
-
setScrollBarPositionFromCorner(positionFromCorner)Set the scroll bar positions from the left-bottom corner (horizontal) and right-top corner (vertical).
- Parameters:
- {cc.Point} positionFromCorner
- The position from the left-bottom corner (horizontal) and right-top corner (vertical).
-
setScrollBarPositionFromCornerForHorizontal(positionFromCorner)Set the horizontal scroll bar position from left-bottom corner.
- Parameters:
- {cc.Point} positionFromCorner
- The position from left-bottom corner
-
setScrollBarPositionFromCornerForVertical(positionFromCorner)Set the vertical scroll bar position from right-top corner.
- Parameters:
- {cc.Point} positionFromCorner
- The position from right-top corner
-
setScrollBarWidth(width)Set the scroll bar's width
- Parameters:
- {number} width
- The scroll bar's width
-
setTouchTotalTimeThreshold(touchTotalTimeThreshold)Set the touch total time threshold
- Parameters:
- {Number} touchTotalTimeThreshold
-
stopAutoScroll()Immediately stops inner container scroll initiated by any of the "scrollTo*" member functions
-
update(dt)The update callback handler.
- Parameters:
- {Number} dt