手机晃动

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{
    
    if (event.subtype == UIEventSubtypeMotionShake) {
        
        NSLog(@"摇晃中");
    }
}

- (BOOL)canBecomeFirstResponder{
    
    return YES;
}
原文地址:https://www.cnblogs.com/yintingting/p/4649544.html