【UIKit】-2- UIAccelerometer-加速计事件
来源:互联网 发布:mac os x系统下载 iso 编辑:程序博客网 时间:2024/06/12 00:57
1.官方文档介绍(加速计事件)
The UIAccelerometer classlets you register to receive acceleration-related data from the onboardhardware. As a device moves, its hardware reports linear acceleration changesalong the primary axes in three-dimensional space. You can use this data todetect both the current orientation of the device (relative to the ground) andany instantaneous changes to that orientation. You might use instantaneouschanges as input to a game or to initiate some action in your application.
You do not createaccelerometer objects directly. Instead, you use the shared UIAccelerometer objectto specify the interval at which you want to receive events and then set itsdelegate property.Upon assigning your delegate object, the accelerometer object begins deliveringacceleration events to your delegate immediately at the specified interval.Events are always delivered on the main thread of your application.
The maximumfrequency for accelerometer updates is based on the available hardware. You canrequest updates less frequently but cannot request them more frequently thanthe hardware maximum. Once you assign your delegate, however, updates aredelivered regularly at the frequency you requested, whether or not theacceleration data actually changed. Your delegate is responsible for filteringout any unwanted updates and for ensuring that the amount of change issignificant enough to warrant taking action.
For moreinformation about the data delivered to your observer, see UIAcceleration Class Reference. Forinformation about implementing your delegate object, see
该UIAccelerometer类,可以注册从板载硬件加速接收相关数据。作为设备移动时,其硬件报告沿在三维空间中的主轴的线性加速度的变化。可以使用此数据,以检测所述设备(相对于地面)和任何瞬间变化至该方向的两个当前方向。您可以使用瞬间变化为输入到游戏或启动应用程序中的一些行动。你不直接创建对象的加速度。相反,您使用的UIAccelerometer对象指定您希望接收事件,然后设置其属性代表的时间间隔。一旦您指定委托对象,加速计对象开始在指定的时间间隔立即交付加速事件的委托。事件总是交付应用程序的主线程上。的最大频率的加速度计的更新是根据可用的硬件。你可以不经常更新的要求,但不能要求他们更频繁地比硬件最大。一旦你分配你的代表,但是,更新定期在您要求的频率交付,加速数据是否真正改变。您的代理负责过滤掉任何不想要的更新,并确保变化量是足够显著以保证采取行动。有关发送到您的观测数据的详细信息,请参阅UIAcceleration类参考。
"UIAccelerometer has been replaced by the CoreMotion framework"
1、iOS5.0以前,可以使用UIAcceleration来监听加速计事件。
2、Bug iOS5.0以后,UIAccelerometerDelegate已经被depreacated,
3、针对iOS4.0以上版本,推荐使用CMMotionManager来监听加速计事件。
- 【UIKit】-2- UIAccelerometer-加速计事件
- UIAccelerometer 加速计
- UIAccelerometer 加速计
- UIAccelerometer 加速计
- UIAccelerometer 加速计 UIAcceleration
- UIAccelerometer 加速计
- UIAccelerometer 加速计
- UIAccelerometer 加速计 UIAcceleration
- UIAccelerometer加速计
- UIAccelerometer 加速计
- iOS内置加速计(UIAccelerometer/CoreMotion)
- iOS内置加速计(UIAccelerometer/CoreMotion)
- UIAccelerometer 加速计(iOS5就已经过期)
- 加速度与加速计(UIAcceleration类,UIAccelerometer类及UIAccelerometerDelegate委托)
- 加速度与加速计(UIAcceleration类,UIAccelerometer类及UIAccelerometerDelegate委托)
- ios 加速传感器UIAccelerometer
- 加速计
- 加速计
- HDU 5289 Assignment(多校联合第一场1002)
- 使用python客户端访问hive
- android 仿ios 对话框已封装成工具类
- SVN常见问题(一)
- Android Activity四种启动模式
- 【UIKit】-2- UIAccelerometer-加速计事件
- poj 2420 A Star not a Tree? -- 模拟退火
- 神级代码编辑器 Sublime Text 全程指南
- UIWebView与JavaScript相互调用
- mac 中安装git
- Android scrollview中有EditText ,需要EditText 滑动时
- iOS 各种控件默认高度
- #笔记#圣思园 JavaWeb 第53讲——function对象、工厂方式、构造函数方式、原型方式定义对象
- Demo and Test Setup Guide - OFBiz Project Administration Workspac