- 浏览: 659654 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
lizaochengwen:
网络请求碰到的中文乱码使用encodeURL吧- (NSStr ...
iPhone开发/iPad开发 中文乱码问题 -
hhb19900618:
还是没弄懂怎么解决了中文乱码? 正确代码能重写贴出吗
iPhone开发/iPad开发 中文乱码问题 -
zhengjj_2009:
我的理解是讲ipa文件解压缩之后再重新打包,已经破坏了签名,所 ...
xcodebuild和xcrun实现自动打包iOS应用程序 -
zhengjj_2009:
我参考你的“ 从ipa格式的母包生成其它渠道包的shell脚本 ...
xcodebuild和xcrun实现自动打包iOS应用程序 -
同一片天空:
问题果然解决了
iOS 搭建 XMPP实现环境
继承自: 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
发表评论
-
SOCK_STREAM和SOCK_DGRAM
2015-07-23 20:08 1640sock_stream 是有保障的(即能保证数据正确传送到 ... -
SOCKET bind INADDR_LOOPBACK和INADDR_ANY的区别
2015-07-23 19:49 2057今天写程序时候,服务器端启动了,然后客户端总是连接不上,con ... -
htons()
2015-07-23 19:26 580在C/C++写网络程序的时候,往往会遇到字节的网络顺序和主机顺 ... -
使用symbolicatecrash分析crash文件
2015-03-10 11:32 1179原文 http://www.cnblogs.com/ning ... -
程序设计中的计算复用(Computational Reuse)
2015-02-10 10:18 662从斐波那契数列说起 ... -
didReceiveMemoryWarning
2015-02-09 16:11 541IPhone下每个app可用的内存是被限制的,如果一个app使 ... -
iOS开发中怎么响应内存警告
2015-02-09 16:08 654好的应用应该在系统内存警告情况下释放一些可以重新创建的资源。在 ... -
ASIHTTPRequest多次重复请求的问题
2014-12-17 14:34 641在一个车票订购的项目中,点击一次订购,却生成了2次订单,通过抓 ... -
从 CloudKit 看 BaaS 服务的趋势
2014-09-26 11:51 726从 6 月份 WWDC 苹果发布 ... -
ios编程--AVCapture编程理解
2014-09-26 11:03 9230、媒体采集的几个东西。这里所需要明白的是,在这个流程中,这里 ... -
NSURLProtocol
2014-09-25 10:42 8191、http://nshipster.com/nsurlpro ... -
关于iOS8的extension插件
2014-09-25 10:41 1279关于iOS8的extension插件,有兴趣的同学可以参考一下 ... -
【转】ios app在itunesConnect里面的几种状态
2014-08-05 10:34 1145Waiting for Upload (Yellow) Ap ... -
[转]iOS Dev (45) iOS图标与切片处理工具Prepo
2014-02-07 17:02 1034iOS Dev (45) iOS图标与切片处理工具Prepo ... -
phoneGap开发IOS,JS调用IOS方法/phoneGap插件开发
2014-01-13 17:49 1244前沿 废话不说phoneGap是什么不多介绍,官方网站: h ... -
如何在IOS平台下搭建PhoneGap开发环境(PhoneGap2.5)
2014-01-13 15:23 747由于在下最近在做基于HTML5的跨平台移植,搭建环境的时候着实 ... -
xcode 4 制作静态库详解
2013-12-20 18:27 533最近在做Apple的IOS开发,有开发静态库的需求,本身IOS ... -
【翻译】ios教程-创建静态库
2013-12-20 18:19 3108作者:shede333 主页:htt ... -
封装自己的控件库:iPhone静态库的应用
2013-12-20 17:03 581由于iPhone 控件的极度匮乏和自定义组件在重用上的限制,在 ... -
iphone:使用NSFileManager取得目录下所有文件(遍历所有文件)
2013-11-18 17:56 870From:http://note.sdo.com/u/xiao ...
相关推荐
ios事件响应链,重写- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event以及- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event方法来查看系统响应事件的逻辑
1. `- (void)touchesBegan:(NSSet*> *)touches withEvent:(UIEvent *)event;`:当一个或多个手指首次接触屏幕时,系统会调用此方法。`touches`参数包含所有当前触碰屏幕的UITouch对象,`event`参数包含了整个事件的...
override func touchesBegan(_ touches: Set, with event: UIEvent?) { guard let touch = touches.first else { return } touchStartPoint = touch.location(in: self) } override func touchesMoved(_ ...
首先,UIEvent是iOS系统中处理触摸事件的核心对象,它封装了一系列的UITouch实例,代表用户的触摸动作。在iOS的事件模型中,当用户与屏幕交互时,事件会沿着响应者链(UIResponder Chain)从最上层的窗口对象向下...
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // 在这里处理触摸开始时的动作 } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { // 在这里处理手指移动时的动作 }...
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"touchesBegan"); } ``` 2. **touchesMoved:** 当一个或多个手指在屏幕上滑动时被触发。 - **示例代码**: ```objective-c -(void...
(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ self.touchTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(addView) userInfo:nil repeats:NO];...
#### MouseEvent进一步扩展了UIEvent,提供了鼠标事件特有的属性: - **`button`**:表示触发事件的鼠标按钮(0表示左键,1表示中键,2表示右键)。 - **`altKey`、`ctrlKey`、`shiftKey`、`metaKey`**:这些布尔值...
override func touchesBegan(_ touches: Set, with event: UIEvent?) { // 处理触摸开始的逻辑 } override func touchesMoved(_ touches: Set, with event: UIEvent?) { // 处理触摸移动的逻辑 } override func ...
2. **UIEvent对象**:UIEvent封装了各种事件,如单个触摸、摇动或远程控制操作。它包含了事件的所有相关信息,使得应用程序可以适当地响应。 3. **多点触控事件**:当用户与应用的视图进行交互时,应用会接收到多点...
1. `- (void)touchesBegan:(NSSet*> *)touches withEvent:(UIEvent *)event;` 这个方法在用户手指首次接触屏幕时被调用。`touches`参数是一个NSSet对象,包含了所有在该事件中开始触摸的UITouch对象。`event`参数则...
此外,还需要实现`-(void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event`和`-(void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event`方法,分别处理触摸移动和触摸结束的事件。 总的来说,...
- `- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event`处理触摸开始事件。 - `- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event`处理触摸移动事件。 - `- (void)touchesEnded...
- `- (void)touchesBegan:(NSSet*> *)touches withEvent:(UIEvent *)event;` - `- (void)touchesMoved:(NSSet*> *)touches withEvent:(UIEvent *)event;` - `- (void)touchesEnded:(NSSet*> *)touches withEvent:...
override func touchesBegan(_ touches: Set, with event: UIEvent?) { // 触摸开始时的动作 } override func touchesMoved(_ touches: Set, with event: UIEvent?) { // 触摸移动时的动作 } override func ...
YSTabBarOutSide文件夹:控件... override func point(inside point: CGPoint, with event: UIEvent?) -> Bool { for item in subviews{ if item.frame.contains(point){ return true } } return false }
- `touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event` - `touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event` - `touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event` - `...
通过重写`- (void)touchesBegan:(NSSet*> *)touches withEvent:(UIEvent *)event`、`- (void)touchesMoved:(NSSet*> *)touches withEvent:(UIEvent *)event`、`- (void)touchesEnded:(NSSet*> *)touches withEvent:...
描述中的代码片段`-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event`是Objective-C语言中处理触摸开始事件的关键方法,它属于UIResponder类的一部分,是所有可以响应用户交互的iOS对象的基类。...