触摸事件About Events in iOS

3触摸事件About Events in iOS

1、UIKit Makes It Easy for Your App to Detect Gestures

uicontrol、Gesture recognizers(powerful, reusable, and adaptable.)

create your own gesture recognizer to recognize a new gesture

2、An Event Travels Along a Specific Path Looking for an Object to Handle It

事件响应链

UIEvent:封装一系列的触摸事件

对于 motion events,取决于你所使用的framework以及type

the hit-test view:-------the event to the view where the touch occurred.

The lowest view in the view hierarchy that contains the touch point becomes the hit-test view

Motion and remote control events——send to the first responder for handling

hit-test检查order:从super  到sub

so, 超出super的subview的部分,响应不到(super并不包含sub超出super的frame)

A touch object is associated with its hit-test view for its lifetime, even if the touch later moves outside the view.

An object becomes the first responder by doing two things:

1--- Overriding the canBecomeFirstResponder method to return YES.

2-----Receiving a becomeFirstResponder message. If necessary, an object can send itself this message.

If you try to assign the first responder in viewWillAppear:, your object graph is not yet established, so the becomeFirstResponder method returns NO.

Text editing. When a user taps a text field or a text view, that view automatically becomes the first responder. By default, the virtual keyboard appears and the text field or text view becomes the focus of editing. You can display a custom input view instead of the keyboard if it’s appropriate for your app. You can also add a custom input view to any responder object.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,496评论 0 23
  • 我之所以发现花未眠,大概也是我独自住在旅馆里,凌晨四时就醒来的缘故吧。 ————花未眠 每一个人都是一朵花,从不相...
    不良公子阅读 3,265评论 0 2
  • 一、 好奇心害死猫,这话真不假。我本是那不羁旅人,四处游玩,自在的很。只因我偶然路过那梦之国,对他们那“造梦”好奇...
    怡盛凡阅读 1,364评论 0 0
  • 我打算开坑写一写大学以来在学校的生活,作为青春的纪念。 计划时间为几个月,有时间就写上几百字。 可能会有一些令人不...
    我不是注销了吗阅读 1,643评论 2 0
  • 关于她的记忆, 像一朵小花, 于我的血肉中微绽, 用细弱的呼喊提醒我, 那跳动的心脏曾叫她撑开了一块地方, 然后,...
    虚掷阅读 2,885评论 0 4

友情链接更多精彩内容