import UIKit
class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } //开始摇晃 override func motionBegan(motion: UIEventSubtype, withEvent event: UIEvent) { println("开始摇晃") } //摇晃结束 override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent) { println("摇晃结束") } //摇晃被意外终止 override func motionCancelled(motion: UIEventSubtype, withEvent event: UIEvent) { println("摇晃被意外终止") }}