如何查询使用钛父视图的子视图?视图

2023-09-07 10:48:29 作者:-冷眼看邇脫離涐

我期待建立一个通用的程序,将工作在一个视图的孩子。在例行我需要能够遍历子视图。我没有看到任何的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]);
        }
    }