实现摇一摇, 在iOS中有2种方式1. 利用加速计的值, 来判断是否摇动了2. 利用系统封装好的motionBegan,如今基本都在使用此方式spa
//相似touchBegan3d
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)eventorm
{it
NSLog(@"开始摇一摇");io
}event
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)eventmargin
{touch
NSLog(@"摇完了");top
}ant
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
NSLog(@"摇动取消");
}