Created
November 30, 2017 05:15
-
-
Save hmhmsh/5f6550923810f7972c51e51010fab282 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MotionShake.swift | |
// | |
override func canBecomeFirstResponder() -> Bool { | |
return true | |
} | |
override func motionBegan(motion: UIEventSubtype, withEvent event: UIEvent?) { | |
if event!.type == UIEventType.Motion && event!.subtype == UIEventSubtype.MotionShake { | |
// シェイク動作始まり時の処理 | |
// shake`s motion is beginning | |
} | |
} | |
override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent?) { | |
if event!.type == UIEventType.Motion && event!.subtype == UIEventSubtype.MotionShake { | |
// シェイク動作終了時の処理 | |
// shake`s motion is finished | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment