如何枚举 Sprite Kit 场景中的所有节点? [英] How to enumerate ALL nodes in a Sprite Kit scene?

查看:17
本文介绍了如何枚举 Sprite Kit 场景中的所有节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想枚举场景中的所有节点.不仅是场景本身的孩子,还有那些的孩子,以及那些的孩子等等......所以我希望能够遍历整个节点层次结构.

I want to enumerate all the nodes in my scene. Not just the ones that are a child of the scene itself, but also the children of those, and the children of those etc... So I want to be able to go through the whole node hierarchy.

有没有办法在不知道节点树有多深的情况下做到这一点?

Is there a method to do that without knowing how deep the node tree goes?

推荐答案

是的,使用 enumerateChildNodesWithName:usingBlock: 并传递 //* 作为节点名称.您应该可以在任何节点上调用它.

Yep, use enumerateChildNodesWithName:usingBlock: and pass //* as the node name. You should be able to call that on any node.

它实际上是 苹果文档:

//* 此搜索字符串匹配节点树中的每个节点.

//* This search string matches every node in the node tree.

这篇关于如何枚举 Sprite Kit 场景中的所有节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆