当我实现这个方法时,我终止了 SourceKitService:
override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!)
如果我删除 !, 有用。但是后来我的代码当然出错了。完整代码:
override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
for touch: AnyObject in touches {
let location = touch.locationInNode(self)
if nodeAtPoint(location).name == "plane" {
println("plane touched")
}
}
}