LoginSignup
12
12

More than 5 years have passed since last update.

[Swift]モーションセンサーからイベントを呼び出す

Posted at

import CoreMotionするとより詳細な加速度センサの値にアクセスできます本体を振ってキャンセルなどの処理をさせたいだけの場合、ViewControllerに下記のようなコードを挿入するだけで良いようです。

    override func motionBegan(motion: UIEventSubtype, withEvent event: UIEvent) {
        NSLog(“Swing!")
        /* code */ 
    }
12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12