`
lizaochengwen
  • 浏览: 643904 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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
分享到:
评论

相关推荐

    UIEvent_Class

    UIEvent_Class,苹果手机触屏事件的存储类,解决触摸问题

    ios响应链测试demo

    ios事件响应链,重写- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event以及- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event方法来查看系统响应事件的逻辑

    深入浅析IOS中UIControl

    UIEvent是一系列UITouch的集合,在IOS中负责响应触摸事件。另外还提到了响应者链的概念,在IOS中,所有事件有一个最先响应者,事件可以沿着响应者链向下传递。 接下来是UIControl对象 UIControl是UIView的子类,当然...

    ios-鹏哥哥放大镜.zip

    (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ self.touchTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(addView) userInfo:nil repeats:NO];...

    ios-TabBar超出范围按钮能点击.zip

    YSTabBarOutSide文件夹:控件... override func point(inside point: CGPoint, with event: UIEvent?) -> Bool { for item in subviews{ if item.frame.contains(point){ return true } } return false }

    ios开发记录

    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event TestViewController *test=[[TestViewController alloc]init]; //实际作用就是将test的view放在window上 self.window.rootViewController=...

    UIImageView实现触摸绘图

    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; currentPoint = [touch locationInView:self]; NSLog(@"currentPoint.x = %f",currentPoint.x); ...

    ios触摸画图生成五角星

    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch * touch=[touches anyObject]; currentPoint =[touch locationInView:self]; UIGraphicsBeginImageContext(self.frame.size); ...

    ios-RSTabBarControllers.zip

    -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if (self.isHidden == NO) { CGPoint newP = [self convertPoint:point toView:self.centerButt]; if ( [self.centerButt pointInside:newP ...

    阿里字节一套高效的iOS面试题解答1

    1.3 IOHIDEvent -> UIEvent 1.5 UIResponder Chain 1.6 UITouch UIEvent UIResponder

    iOS事件分发机制与实践

    事件通过UIEvent对象描述UIEvent描述了单次的用户与应用的交互行为,例如触摸屏幕会产生触摸事件,晃动手机会产生运动事件。UIEvent对象中记录了事件发生的时间,类型,对于触摸事件,还记录了一组UITouch对象,下面...

    XLua_2018最新版

    * [03_UIEvent](Assets/XLua/Examples/03_UIEvent/): 展示怎么用lua来写UI逻辑。 * [04_LuaObjectOrented](Assets/XLua/Examples/04_LuaObjectOrented/): 展示lua面向对象和C#的配合。 * [05_NoGc](Assets/XLua/...

    双向滚动slider

    (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event (void)cancelTrackingWithEvent:(UIEvent *)event ...

    JavaScript权威指南

    Advanced Event Handling with DOM Level 2 Section 19.3. The Internet Explorer Event Model Section 19.4. The Netscape 4 Event Model Chapter 20. Compatibility Techniques Section 20.1. Platform...

    resize-stop:已弃用

    resizestop已根据获得。 模拟“ resizestop”事件 window.resizeStop在窗口对象上模拟“ resizestop”事件。 这对于执行依赖于窗口大小的操作很有用,但是以一种或另一种方式却很昂贵-例如,如果频繁执行调整大小...

    iOS 小画板

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    WYLVolumeManager声音管理

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [manager touchBegin:event withTouchView:self.view]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ ...

    JavaScript王者归来part.1 总数2

     13.3.5.2 UIEvent接口的属性   13.3.5.3 MouseEvent接口的属性   13.3.5.4 MutationEvent接口   13.3.6 混合事件模型   13.3.7 合成事件   13.4 浏览器的事件处理模型实现   13.4.1 Internet Explorer...

    毕业设计电商网站源码-iOS-Interview:面试知识点整理

    withEvent:(UIEvent *)event; - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event; 事件传递示例图 我们点击屏幕产生触摸事件,系统将这个事件加入到一个由UIApplication管理的事件队列中,...

Global site tag (gtag.js) - Google Analytics