最近频繁地用到了以下函数
enumerateChildNodes(withName: "//*", using: { node, _ in
if let eventListenerNode = node as? EventListenerNode{
eventListenerNode.didMoveToScene()
}
其中用到了“//*”,看了相关解释如下:
• /name: Search for nodes named “name” in the root of the hierarchy.
• //name: Search for nodes named “name” starting at the root and moving
recursively down the hierarchy.
- means any name
那么//*的意思就是从根目录开始搜索所有树形目录的搜索文件
Mark