跳到主要内容

获取当前app的节点信息(nodeView.info)

函数

节点信息 =  nodeView.info()

返回值

  • 节点信息 文本型

说明

返回当前正在前台运行app 的节点信息 json文本。

此方法只能在 2.3.0以上版本中使用

示例

local drawViews = {}  -- 绘制对像存储 防止自动回收
local enumerationInfo --屏幕绘制函数
enumerationInfo = function (info)
local drawView = screenDraw.init(info.frame.x, info.frame.y, info.frame.width, info.frame.height, info.text and info.text or "")
table.insert(drawViews, drawView)
drawView:show()
if (type(info.subviews) == "table") then
for key, value in pairs(info.subviews) do
enumerationInfo(value)
end
end
end

local info = nodeView.info() -- 获取节点信息
enumerationInfo(json.decode(info)[1]) -- 绘制节点信息

sys.msleep(10000) -- 延迟等待 10000毫秒后结束脚本