手势

作者: 我是小胡胡分胡 | 来源:发表于2017-07-21 11:39 被阅读47次

UIResponder->UIView->UIControl

1, UIResponder

  • (void)touchesXXXXX:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;

2, UIGestureRecognizer

@interface UIView : UIResponder
@interface UIView (UIViewGestureRecognizers)

@property(nullable, nonatomic,copy) NSArray<__kindof UIGestureRecognizer *> *gestureRecognizers NS_AVAILABLE_IOS(3_2);

优先级最高响应,并忽略UIControl方法响应;

直接通过UIApplication直接向其派发消息,并且不再向响应者链派发消息。
[UIWindow sendEvent:] ---> [UIGestureEnvironment _updateGesturesForEvent:window:]--->

@interface UIGestureRecognizer (UIGestureRecognizerProtected)

// mirror of the touch-delivery methods on UIResponder
// UIGestureRecognizers aren't in the responder chain, but observe touches hit-tested to their view and their view's subviews
// UIGestureRecognizers receive touches before the view to which the touch was hit-tested

  • (void)touchesXXXXX:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;

state:possible/began/changed/ended/cancelled/failed
enable
cancelsTouchesInView
delaysTouchesBegan
delaysTouchesEnd
allowedTouchTypes
allowedPressTypes
requiresExclusiveTouchType

  1. UIControl
    @interface UIControl : UIView

[UIWindow sendEvent:] ---》 [UIWindow _sendTouchesForEvent:]

会重写父类(UIResponder)的touchesXXXXX方法,可能会直接取消touchesCancelled/

highlighted
tracking
touchInside
selected
enabled
state:normal/highlighted/disabled/selected/focused/application/reserved

touchesBegan-> beginTrackingWithTouch
touchesEnded-> endTrackingWithTouch->target/action

touchesBegan-> beginTrackingWithTouch
touchesMoved-> continueTrackingWithTouch
touchesMoved-> continueTrackingWithTouch
touchesMoved-> continueTrackingWithTouch->pointinside
touchesEnded->pointinside-> endTrackingWithTouch

相关文章

  • 手势

    点击手势 捏合手势 旋转手势 轻扫手势 拖拽手势 边缘平移手势 长按手势

  • iOS-手势详细参数说明

    敲击手势 长按手势 滑动手势 拖动手势 旋转手势 捏合手势 两种手势作用在同一个视图

  • 【iOS学习】——手势识别

    iOS 手势 手势需要开启用户交互 点击手势 单击手势 双击手势 添加 numberOfTapsRequired...

  • Swift - UIGestureRecognizer 各种手势

    1、点击手势2、拖动手势3、长按手势4、滑动手势5、捏合手势6、旋转手势 完整代码

  • iOS七种手势详解

    1、轻拍手势 2、捏合手势 3、旋转手势 4、平移手势 5、边缘轻扫手势 6、长按手势 7、轻扫手势 给image...

  • iOS手势总结

    1.轻拍手势 2.长按手势 3.轻扫手势 4.平移手势 5.捏合手势 6.旋转手势 7.边缘手势

  • iOS 手势

    修改时间: 2016-12-19修改次数: 0 手势传递 点击手势 捏合手势 轻扫手势 拖动手势 长按手势

  • iOS手势操作

    iOS手势有六种 手势类型: 手势状态: 创建View添加手势 1.轻点手势( UITapGestureRecog...

  • Vue手势

    点击手势 滑动手势 手势的方法

  • UI梳理——手势

    手势分类: 手势的创建: 方法的实现: 轻扫手势:UISwipeGestureRecognizer 长按手势: 以...

网友评论

      本文标题:手势

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