Class cc.ScrollView
- Defined in: CCScrollView.js
Constructor Attributes | Constructor Name and Description |
---|---|
ScrollView support for cocos2d -x.
|
Method Summary
Class Detail
cc.ScrollView()
ScrollView support for cocos2d -x.
It provides scroll view functionalities to cocos2d projects natively.
Field Detail
{Boolean}
bounceable
- Indicate whether the scroll view is bounceable
{Boolean}
clippingToBounds
- Indicate whether the scroll view clips its children
{cc.Layer}
container
- The inside container of the scroll view
{cc.ScrollViewDelegate}
delegate
- The inside container of the scroll view
{Number}
direction
- The direction allowed to scroll: cc.SCROLLVIEW_DIRECTION_BOTH by default, or cc.SCROLLVIEW_DIRECTION_NONE | cc.SCROLLVIEW_DIRECTION_HORIZONTAL | cc.SCROLLVIEW_DIRECTION_VERTICAL
{cc.Point}
maxOffset
- <@readonly> The current container's maximum offset
{cc.Point}
minOffset
- <@readonly> The current container's minimum offset
{cc.Size}
viewSize
- The size of the scroll view
Method Detail
-
Returns an autoreleased scroll view object.
- Returns:
- {cc.ScrollView} scroll view object
-
getDirection()direction allowed to scroll. CCScrollViewDirectionBoth by default.
-
getViewSize()
size to clip. CCNode boundingBox uses contentSize directly.
It's semantically different what it actually means to common scroll views.
Hence, this scroll view will use a separate size property. -
{Boolean} initWithViewSize(size, container)initialized whether success or fail
- Returns:
- {Boolean}
-
isClippingToBounds()Determines whether it clips its children or not.
-
{Boolean} isNodeVisible(node)Determines if a given node's bounding box is in visible bounds
- Parameters:
- {cc.Node} node
- Returns:
- {Boolean} YES if it is in visible bounds
-
onTouchBegan(touch, event)override functions
- Parameters:
- touch
- event
-
pause(sender)Provided to make scroll view compatible with SWLayer's pause method
- Parameters:
- sender
-
resume(sender)Provided to make scroll view compatible with SWLayer's resume method
- Parameters:
- sender
-
setContentOffset(offset, animated)Sets a new content offset. It ignores max/min offset. It just sets what's given. (just like UIKit's UIScrollView)
- Parameters:
- {cc.Point} offset
- new offset
- {Number} animated Optional
- If true, the view will scroll to the new offset
-
setContentOffsetInDuration(offset, dt)
Sets a new content offset. It ignores max/min offset. It just sets what's given. (just like UIKit's UIScrollView)
You can override the animation duration with this method.- Parameters:
- {cc.Point} offset
- new offset
- {Number} dt
- animation duration
-
setZoomScale(scale, animated)Sets a new scale and does that for a predefined duration.
- Parameters:
- {Number} scale
- a new scale vale
- {Boolean} animated Optional, Default: null
- if YES, scaling is animated
-
setZoomScaleInDuration(s, dt)Sets a new scale for container in a given duration.
- Parameters:
- {Number} s
- a new scale value
- {Number} dt
- animation duration