2018-01-24 搜索方法记录
2018-01-24 本文已影响33人
Sesshomaru
最近频繁地用到了以下函数
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