2017-08-28 85 views
0

孩子,我想選擇這樣的孩子的孩子:
選擇孩子的SWIFT 3

var button = childNode(withName: "button") as! SKSpriteNode 

SKSpriteNode內部「通知」中,選擇一個孩子使用時存在SKSpriteNode「按鈕」

回答

1

childNode(withName: "button")這是self.childNode(withName: "button")自己是你在(或場景)中的任何課程的簡寫。打電話給對象使用的孩子...

let alert = self.childNode(withName: "alert") as! SKSpriteNode 
var button = alert.childNode(withName: "button") as! SKSpriteNode