加入coremotion.framework 包含 头文件 #import<CoreMotion/CoreMotion.h> CMMotionManager *motionManager //定义一个陀螺仪管理器 self.motionManager=[[[