Ios 重写func touchesbented(touchs:NSSet,withEvent:UIEvent){movingground.start()

Ios 重写func touchesbented(touchs:NSSet,withEvent:UIEvent){movingground.start(),ios,swift,Ios,Swift,显示 方法不重写来自其超类的消息 但是,如果您删除该命令,游戏将不会对您的触摸做出响应。因此,基本上我会从游戏中传递代码,您将看到它们的区别: override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { movingground.start() 覆盖函数触摸开始(触摸:设置,withEvent事件:UIEvent?){ 如果让触摸=先触摸{ //检测触摸位置 让touchLocation=touch

显示

方法不重写来自其超类的消息


但是,如果您删除该命令,游戏将不会对您的触摸做出响应。

因此,基本上我会从游戏中传递代码,您将看到它们的区别:

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {        movingground.start()
覆盖函数触摸开始(触摸:设置,withEvent事件:UIEvent?){
如果让触摸=先触摸{
//检测触摸位置
让touchLocation=touch.locationInNode(自身)
//你的代码在这里
}
这个方法很好用。试着用它代替你的。(我用的是Swift 2.0)

 override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?){
  if let touch = touches.first {

      // detecting touch location
      let touchLocation = touch.locationInNode(self)

      //your code going here
}