我想在2秒後用戶觸摸屏幕(它在touchesBegan裏面),但它不起作用addChild。我做錯了什麼?2秒後addChild
//show myLabel after 2 seconds
self.myLabel.position = CGPoint(x: self.frame.width/1.1, y: self.frame.height/2)
self.myLabel.text = "0"
self.myLabel.zPosition = 4
self.myLabel.runAction(SKAction.sequence([SKAction.waitForDuration(2.0), SKAction.runBlock({
self.addChild(self.myLabel)
)]))
第二個工作,但我不得不改變一些事情(由Xcode的指導下使用)。它結束了: 'self.runAction(SKAction.waitForDuration(2.0),completion:{self.addChild(self.myLabel)})' – Luiz
順便說一句,謝謝! =) – Luiz
不客氣!我在Xcode中測試後編輯了我的答案。如果答案對您有幫助,請考慮投票和/或接受它:) – smallfinity