ios 摇一摇功能的实现(http://blog.csdn.net/pearlhuzhu/article/details/9986663)
是利用UIResponder中有这些方法:
-(void)motionBegan:(UIEventSubtype)motionwithEvent:(UIEvent *)event{
NSLog(@"began");
}
-(void)motionCancelled:(UIEventSubtype)motionwithEvent:(UIEvent *)event{
NSLog(@"cancel");
}
-(void)motionEnded:(UIEventSubtype)motionwithEvent:(UIEvent *)event{
NSLog(@"end");
}
UIResponder Class Reference:
Android开发---摇一摇功能(http://blog.csdn.net/xn4545945/article/details/9001097)
加速度传感器:Sensor.TYPE_ACCELEROMETER
摇一摇功能主要是监听手机加速度变化,当超过设定的某一值时,即触发事件。