cocos2d JS 创建实现换行功能的聊天文本 testLable

-- 创建实现换行功能的文本 

function LoadLabelHeroIntroduce(objLabelContent)  //传入文本

---------------------------------     

 local tLabel = LG.Label:create() 

--  实现换行功能      tLabel:ignoreContentAdaptWithSize(false)    

   tLabel:setText(objLabelContent)    // 文本赋值

  local tSize = tLabel:getContentSize()    // 获取 size

  local tmp_width = tSize.width   

   local end_height = (tmp_width / 180 +1)* (tSize.height)   // 计算高度

   tLabel:setSize(Global_CCSize(180,end_height))     // 设置side

 return tLabel 

---------------------------------  end

原文地址:https://www.cnblogs.com/luorende/p/7204706.html