UIEvent


继承自: UIResponder : NSObject
遵 循: NSObject (NSObject)
框 架: /System/Library/Frameworks/UIKit.framework
可用平台: iPhone OS 2.0 或者更新
接口类: UIEvent.h
关联例子: aurioTouch
GLPaint
MoveMe
Touches

目录 [隐藏]
1 Overview
2 Tasks
2.1 Getting the Touches for an Event
2.2 Getting Event Attributes
3 Properties
3.1 timestamp
4 Instance Methods
4.1 allTouches
4.2 touchesForView:
4.3 touchesForWindow:
[编辑]
Overview

概述
A UIEvent object (or, simply, an event object) represents an event in iPhone OS. An event object contains one or more touches (that is, finger gestures on the screen) that have some relation to the event. A touch is represented by a UITouch object.
一个UIEvent对象(或者,简单的事件对象)在iPhone OS中变现为事件。一个事件对象包含一个或者多个触摸(那是,手指在屏幕上的交互)关联事件。一个触摸事件表现为一个UITouch对象。
When an event occurs, the system routes it to the appropriate responder and passes in the UIEvent object in a message invoking a UIResponder method such as touchesBegan:withEvent:. The responder can then evaluate the touches for the event or for a particular phase of the event and handle them appropriately. The methods of UIEvent allow you to obtain all touches for the event (allTouches) or only those for a given view or window (touchesForView: or touchesForWindow:). It can also distinguish an event object from objects representing other events by querying an object for the time of its creation (timestamp).
当一个事件触发了,系统将会把它传递给合适的响应对象并通过UIEvent对象发出一个消息调用UIResponder方法如 touchesBegan:withEvent: 。响应对象可以分配触摸事件到合适的触摸类型并适当的控制他们。UIEvent中的方法可以让你获取全部的触摸事件或者给定的视图或者窗口(touchesForView: 或者 touchesForWindow:)。它可以分辨从响应对象传递过来的事件对象发生的时间(timestamp)。
A UIEvent object is persistent throughout a multi-touch sequence; UIKit reuses the same UIEvent instance for every event delivered to the application. You should never retain an event object or any object returned from an event object. If you need to keep information from an event around from one phase to another, you should copy that information from the UITouch or UIEvent object.
一个UIEvent对象贯穿在多点触摸事件的序列中;UIKit 重用同一个UIEvent实例来分配每一个事件到应用程序。你不需要保持一个事件对象或者任何从事件对象返回的对象。如果你需要保存事件对象然後传递到另外一个对象,你需要从UITouch或者UIEvent中复制信息。
See "Event Handling" in iPhone Application Programming Guide for further information on event handling.
有关更多事件控制的信息你可以查看 iPhone Application Programming Guide 中的事件控制一章。
[编辑]
Tasks

任务
[编辑]
Getting the Touches for an Event
获取事件中的触摸对象
– allTouches
– touchesForView:
– touchesForWindow:
[编辑]
Getting Event Attributes
获取事件属性
timestamp  property

[编辑]
Properties

属性
For more about Objective-C properties, see “Properties” in The Objective-C 2.0 Programming Language.
更多有关Objective-C属性的信息,请看The Objective-C 2.0 Programming Language中的"Properties"这一章
[编辑]
timestamp
The time when the event occurred. (read-only)
事件发生的时间。(只读)
@property(nonatomic, readonly) NSTimeInterval timestamp
Discussion
讨论
The property value is the number of seconds since system startup.
这个属性的值是一个数字当系统启动的时候。
Availability
可用平台
Available in iPhone OS 2.0 and later.
可用于iPhone OS 2.0或者更新
Declared In
定义文件
UIEvent.h
[编辑]
Instance Methods

实例方法
[编辑]
allTouches
Returns all touch objects associated with the receiver.
返回和接收者有关的所有触摸对象
- (NSSet *)allTouches
Return Value
返回值
A set of UITouch objects representing all touches associated with an event (represented by the receiver).
一个UITouch对象的集合包含所有的触摸事件(取决于那个接收者)
Discussion
讨论
If the touches of the event originate in different views and windows, the UITouch objects obtained from this method will have different responder objects associated with the touches.
如果事件的触摸对象来自不同的视图或者窗口,那UITouch对象将会从不同的响应对象中获取触摸事件。
Availability
可用平台
Available in iPhone OS 2.0 and later.
可用于iPhone OS 2.0或者更新
See Also
同类参考
– touchesForView:
– touchesForWindow:
Related Sample Code
关联的例子代码
aurioTouch
Metronome
Declared In
定义文件
UIEvent.h

[编辑]
touchesForView:
Returns the touch objects that belong to a given view for the event represented by the receiver.
返回属于接收者给定的视图的事件响应的触摸对象
- (NSSet *)touchesForView:(UIView *)view
Parameters
参数
view
The UIView object on which the touches related to the event were made.
一个关联触摸事件发生的UIView对象
Return Value
返回值
An set of UITouch objects representing the touches for the specified view related to the event represented by the receiver.
接收者关联视图的事件响应者发出的UITouch对象集合
Availability
可用平台
Available in iPhone OS 2.0 and later.
可用于iPhone OS 2.0或者更新
See Also
同类参考
– allTouches
– touchesForWindow:
Related Sample Code
关联的例子代码
GLPaint
Declared In
定义文件
UIEvent.h

[编辑]
touchesForWindow:
Returns the touch objects that belong to a given window for the event represented by the receiver.
返回接收者给定的窗口的触摸事件的事件响应对象
- (NSSet *)touchesForWindow:(UIWindow *)window
Parameters
参数
window
The UIWindow object on which the touches related to the event were made.
一个发生触摸事件关联的UIWindow对象
Return Value
返回值
An set of UITouch objects representing the touches for the specified window related to the event represented by the receiver.
接收者关联窗口的事件响应者发出的UITouch对象集合
Availability
可用平台
Available in iPhone OS 2.0 and later.
可用于iPhone OS 2.0或者更新
See Also
同类参考
– allTouches
– touchesForView:
Declared In
定义文件
UIEvent.h

你可能感兴趣的:(event)