如何查询使用钛父视图的子视图? [英] How to query the child views of a parent view using Titanium?
本文介绍了如何查询使用钛父视图的子视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我期待建立一个通用的程序,将工作在一个视图的孩子。在例行我需要能够遍历子视图。我没有看到任何的API中,将表明,有什么办法让孩子的意见。有一个添加()和删除()方法,但没有像获得()也没有,似乎有像意见的任何属性。我在想什么?
I am looking to create a general purpose routine that will operate over a view's children. Within the routine I need to be able to iterate over the child views. I don't see anything in the API that would suggest that there is any way to get the child views. There is an "add()" and a "remove()" method but nothing like "get()" nor does there appear to be any properties like "views". What am I missing?
推荐答案
这是基本的结构去除孩子从视图对象
this is the basic structure for removing child objects from a view
if (view.children) {
for (var c = view.children.length - 1; c >= 0; c--) {
view.remove(view.children[c]);
}
}
这篇关于如何查询使用钛父视图的子视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文