import CoreMotion
するとより詳細な加速度センサの値にアクセスできますが本体を振ってキャンセルなどの処理をさせたいだけの場合、ViewController
に下記のようなコードを挿入するだけで良いようです。
override func motionBegan(motion: UIEventSubtype, withEvent event: UIEvent) {
NSLog(“Swing!")
/* code */
}
More than 5 years have passed since last update.
import CoreMotion
するとより詳細な加速度センサの値にアクセスできますが本体を振ってキャンセルなどの処理をさせたいだけの場合、ViewController
に下記のようなコードを挿入するだけで良いようです。
override func motionBegan(motion: UIEventSubtype, withEvent event: UIEvent) {
NSLog(“Swing!")
/* code */
}
Register as a new user and use Qiita more conveniently