【发布时间】:2016-03-14 19:58:21
【问题描述】:
我正在寻找一种在 SKShapeNode 子类中处理触摸的简单方法。为此,我尝试使用touchesBegan,但它不起作用..
class Shape: SKShapeNode {
convenience init(rectOfSize: CGSize, colorOfRectangle rectColor: UIColor) {
self.init()
self.init(rectOfSize: rectOfSize)
self.fillColor = rectColor
self.position = CGPointMake(rectOfSize.width, rectOfSize.height)
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("touch")
}
}
【问题讨论】:
标签: ios swift sprite-kit touchesbegan skshapenode