1 让当前ViewController 能够成为firstResponder
- (BOOL)canBecomeFirstResponder{
return YES;
}
2 重载motion相关函数,实现自己的业务逻辑
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0);
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0);
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0);
(注:这几个函数与touch相关的几个函数一样,都是UIResponder类的"虚函数")