我刚刚开始学习 Swift,我一直在尝试移动 UIView 以响应触摸。我收到一个exc_bad_instruction
错误。
var location = CGPoint(x: 0, y:0)
@IBOutlet weak var person: UIView!
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch : UITouch! = touches.first
location = touch.location(in: self.view)
person.center = location
}