私はViewControllerをtouchesBeganとtouchesEndedの使い方は?
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
print("started")
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
print("ended")
}
上のコードの下に追加さが、それはまったくのメッセージを印刷しません。
ではなく、ビューコントローラのビューにこれらを入れてみてください終わりました。 (私は、これらがUIViewControllerでオーバーライドできることに驚きました) – dfd
@dfd私はSwiftの初心者です。これらのコードをViewControllerではなくViewに配置する方法を教えてください。 –