私はSwiftの学習を始めたばかりです。タッチに反応してUIViewを移動しようとしています。 exc_bad_instruction
エラーが表示されます。exc_bad_instructionをUIViewの中心をcgpointに設定するとき
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
}
? –
@ Mr.UB第6行 –
'center'のタイプは何ですか?' print(location) 'の出力は何ですか? –