Class cc.TextFieldTTF
Extends
cc.LabelTTF.
Defined in: CCTextFieldTTF.js.
Constructor Attributes | Constructor Name and Description |
---|---|
A simple text input field with TTF font.
|
Method Attributes | Method Name and Description |
---|---|
Open keyboard and receive input text.
|
|
<static> |
cc.TextFieldTTF.create(placeholder, dimensions, alignment, fontName, fontSize)
creates a cc.TextFieldTTF from a fontName, alignment, dimension and font size
|
ctor()
Constructor
|
|
Delete backward
|
|
End text input and close keyboard.
|
|
When the delegate detach with IME, this method call by CCIMEDispatcher.
|
|
When the delegate detach with IME, this method call by CCIMEDispatcher.
|
|
draw(ctx)
|
|
initWithPlaceHolder(placeholder, dimensions, alignment, fontName, fontSize)
Initializes the cc.TextFieldTTF with a font name, alignment, dimension and font size
|
|
insertText(text, len)
|
|
keyboardDidHide(info)
|
|
keyboardDidShow(info)
|
|
keyboardWillHide(info)
|
|
keyboardWillShow(info)
|
|
Remove delegate
|
|
setColorSpaceHolder(value)
|
|
setDelegate(value)
|
|
setPlaceHolder(text)
|
|
setString(text, isCallParent)
Input text property
|
- Methods borrowed from class cc.LabelTTF:
- description, getDimensions, getFontName, getFontSize, getHorizontalAlignment, getVerticalAlignment, init, initWithString, setColor, setDimensions, setFontName, setFontSize, setHorizontalAlignment, setOpacity, setVerticalAlignment
- Methods borrowed from class cc.Sprite:
- addChild, displayFrame, getAtlasIndex, getBatchNode, getBlendFunc, getColor, getOffsetPosition, getOpacity, getQuad, getSpriteBatchNode, getTexture, getTextureAtlas, getTextureRect, ignoreAnchorPointForPosition, initWithFile, initWithSpriteFrame, initWithSpriteFrameName, initWithTexture, isDirty, isFlippedX, isFlippedY, isFrameDisplayed, isOpacityModifyRGB, isTextureRectRotated, removeAllChildren, removeChild, reorderChild, SET_DIRTY_RECURSIVELY, setAnchorPoint, setAtlasIndex, setBatchNode, setBlendFunc, setDirty, setDirtyRecursively, setDisplayFrame, setDisplayFrameWithAnimationName, setFlipX, setFlipY, setOpacityModifyRGB, setPosition, setRotation, setScale, setScaleX, setScaleY, setSkewX, setSkewY, setSpriteBatchNode, setTexture, setTextureAtlas, setTextureRect, setVertexRect, setVertexZ, setVisible, sortAllChildren, updateColor, updateTransform, useBatchNode
- Methods borrowed from class cc.Node:
- cleanup, convertToNodeSpace, convertToNodeSpaceAR, convertTouchToNodeSpace, convertTouchToNodeSpaceAR, convertToWorldSpace, convertToWorldSpaceAR, getActionByTag, getActionManager, getAnchorPoint, getAnchorPointInPoints, getBoundingBox, getBoundingBoxToWorld, getCamera, getChildByTag, getChildren, getChildrenCount, getContentSize, getGLServerState, getGrid, getOrderOfArrival, getParent, getPosition, getPositionX, getPositionY, getRotation, getScale, getScaleX, getScaleY, getScheduler, getShaderProgram, getSkewX, getSkewY, getTag, getUserData, getUserObject, getVertexZ, getZOrder, isIgnoreAnchorPointForPosition, isRunning, isVisible, nodeToParentTransform, nodeToWorldTransform, numberOfRunningActions, onEnter, onEnterTransitionDidFinish, onExit, onExitTransitionDidStart, parentToNodeTransform, pauseSchedulerAndActions, release, removeAllChildrenWithCleanup, removeChildByTag, removeFromParent, removeFromParentAndCleanup, resumeSchedulerAndActions, retain, runAction, schedule, scheduleOnce, scheduleUpdate, scheduleUpdateWithPriority, setActionManager, setContentSize, setGLServerState, setGrid, setNodeDirty, setOrderOfArrival, setParent, setPositionX, setPositionY, setScheduler, setShaderProgram, setTag, setUserData, setUserObject, setZOrder, stopAction, stopActionByTag, stopAllActions, transform, transformAncestors, unschedule, unscheduleAllCallbacks, unscheduleUpdate, update, visit, worldToNodeTransform
Method Detail
{Boolean}
attachWithIME()
Open keyboard and receive input text.
- Returns:
- {Boolean}
{Boolean}
canAttachWithIME()
- Returns:
- {Boolean}
{Boolean}
canDetachWithIME()
- Returns:
- {Boolean}
<static>
{cc.TextFieldTTF|Null}
cc.TextFieldTTF.create(placeholder, dimensions, alignment, fontName, fontSize)
creates a cc.TextFieldTTF from a fontName, alignment, dimension and font size
//example // When five parameters var textField = cc.TextFieldTTF.create("", cc.size(100,50), cc.TEXT_ALIGNMENT_LEFT,"Arial", 32); // When three parameters var textField = cc.TextFieldTTF.create(" ", "Arial", 32);
- Parameters:
- {String} placeholder
- {cc.Size} dimensions
- {Number} alignment
- {String} fontName
- {Number} fontSize
- Returns:
- {cc.TextFieldTTF|Null}
ctor()
Constructor
deleteBackward()
Delete backward
{Boolean}
detachWithIME()
End text input and close keyboard.
- Returns:
- {Boolean}
didAttachWithIME()
When the delegate detach with IME, this method call by CCIMEDispatcher.
didDetachWithIME()
When the delegate detach with IME, this method call by CCIMEDispatcher.
draw(ctx)
- Parameters:
- {CanvasContext} ctx
{Number}
getCharCount()
- Returns:
- {Number}
{cc.Color3B}
getColorSpaceHolder()
- Returns:
- {cc.Color3B}
{String}
getContentText()
- Returns:
- {String}
{cc.Node}
getDelegate()
- Returns:
- {cc.Node}
{String}
getPlaceHolder()
- Returns:
- {String}
{String}
getString()
- Returns:
- {String}
{Boolean}
initWithPlaceHolder(placeholder, dimensions, alignment, fontName, fontSize)
Initializes the cc.TextFieldTTF with a font name, alignment, dimension and font size
//example var textField = new cc.TextFieldTTF(); // When five parameters textField.initWithPlaceHolder("", cc.size(100,50), cc.TEXT_ALIGNMENT_LEFT,"Arial", 32); // When three parameters textField.initWithPlaceHolder(" ", "Arial", 32);
- Parameters:
- {String} placeholder
- {cc.Size} dimensions
- {Number} alignment
- {String} fontName
- {Number} fontSize
- Returns:
- {Boolean}
insertText(text, len)
- Parameters:
- {String} text
- {Number} len
keyboardDidHide(info)
- Parameters:
- info
keyboardDidShow(info)
- Parameters:
- info
keyboardWillHide(info)
- Parameters:
- info
keyboardWillShow(info)
- Parameters:
- info
removeDelegate()
Remove delegate
setColorSpaceHolder(value)
- Parameters:
- {cc.Color3B} value
setDelegate(value)
- Parameters:
- {cc.Node} value
setPlaceHolder(text)
- Parameters:
- {String} text
setString(text, isCallParent)
Input text property
- Parameters:
- {String} text
- {Boolean} isCallParent