Class ccui.RichText

Class Summary
Constructor Attributes Constructor Name and Description
 
The rich text control of Cocos UI.

Method Summary

Class Detail

ccui.RichText()
The rich text control of Cocos UI. It receives text, image, and custom node as its children to display.

Method Detail

  • <static> {RichText} ccui.RichText.create()
    create a rich text
    Deprecated:
    since v3.0, please use new ccui.RichText() instead.
    Returns:
    {RichText}
  • ctor()
    create a rich text Constructor of ccui.RichText. override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
    var uiRichText = new ccui.RichTex();
  • formatRenderers()
    Formats richText's renderer.
  • formatText()
    Formats the richText's content.
  • {cc.Size} getContentSize()
    Gets the content size of ccui.RichText
    Returns:
    {cc.Size}
  • {string} getDescription()
    Returns the class name of ccui.RichText.
    Returns:
    {string}
  • {cc.Size} getVirtualRendererSize()
    Returns the renderer container's content size.
    Returns:
    {cc.Size}
  • ignoreContentAdaptWithSize(ignore)
    Ignore the richText's custom size, If ignore is true that richText will ignore it's custom size, use renderer's content size, false otherwise.
    Parameters:
    {Boolean} ignore
  • insertElement(element, index)
    Insert a element
    Parameters:
    {ccui.RichElement} element
    {Number} index
  • pushBackElement(element)
    Push a element
    Parameters:
    {ccui.RichElement} element
  • removeElement(element)
    Remove element
    Parameters:
    {ccui.RichElement} element
  • setAnchorPoint(pt)
    Sets anchor point
    Parameters:
    {cc.Point} pt
  • setCascadeOpacityEnabled(value)
    Allow child renderer to be affected by ccui.RichText's opacity
    Parameters:
    {boolean} value
  • setLineBreakOnSpace(value)
    This allow the RichText layout to break line on space only like in Latin text format by default the property is false, which break the line on characters
    Parameters:
    value
  • setTextHorizontalAlignment(value)
    Set the renderer horizontal flow alignment for the Control although it is named TextHorizontalAlignment, it should work with all type of renderer too. NOTE: we should rename this to setHorizontalAlignment directly
    var richText = new ccui.RichText();
    richText.setTextHorizontalAlignment(cc.Text_ALIGNMENT_RIGHT);
    Parameters:
    {Number} value
    - example cc.TEXT_ALIGNMENT_RIGHT
  • setTextVerticalAlignment(value)
    Set the renderer vertical flow alignment for the Control although it is named TextVerticalAlignment, it should work with all type of renderer too.
    var richText = new ccui.RichText();
    richText.setTextVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
    Parameters:
    {Number} value
    - example cc.VERTICAL_TEXT_ALIGNMENT_CENTER
  • setVerticalSpace(space)
    Sets vertical space
    Parameters:
    {Number} space