美文网首页
触摸事件About Events in iOS

触摸事件About Events in iOS

作者: winnisz | 来源:发表于2017-03-07 17:18 被阅读0次

    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.

    相关文章

      网友评论

          本文标题:触摸事件About Events in iOS

          本文链接:https://www.haomeiwen.com/subject/bgnmgttx.html