zoukankan      html  css  js  c++  java
  • 1.0 iOS中的事件

    本文并非最终版本,如有更新或更正会第一时间置顶,联系方式详见文末
    如果觉得本文内容过长,请前往本人 “简书
     
    在用户使用app过程中,会产生各种各样的事件,iOS中的事件可以分为3大类型:
    UIKit可识别三种类型的输入事件:
    • 触摸事件
    • 加速计事件 / 运动事件
    • 远程控制事件
     
     
     
     
     UIResponder - 响应者对象
     
    概念:
    在iOS中不是任何对象都能处理事件,只有继承了UIResponder的对象才能接收并处理事件。
     
     
    成员:
    UIApplication、UIViewController、UIView都继承自UIResponder,因此它们都是响应者对象,都能够接收并处理事件
     
     
    UIResponder的内部方法:
    1 //触摸事件
    2 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
    3 - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
    4 - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
    5 - (void)touchesCancelled:(nullable NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;
    6 - (void)touchesEstimatedPropertiesUpdated:(NSSet * _Nonnull)touches NS_AVAILABLE_IOS(9_1);
    1 //加速计事件
    2 - (void)motionBegan:(UIEventSubtype)motion withEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);
    3 - (void)motionEnded:(UIEventSubtype)motion withEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);
    4 - (void)motionCancelled:(UIEventSubtype)motion withEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);
    //远程控制事件
    - (void)remoteControlReceivedWithEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(4_0);



    如有疑问,请发送邮件至 shorfng@126.com 联系我。
     
    By:蓝田(Loto)
     
     
     
     
     
  • 相关阅读:
    Mongo库表占用空间统计
    修改elasticsearch默认索引返回数
    针对docker中的mongo容器增加鉴权
    自动化测试框架STAF介绍
    单点登陆思想
    Django请求流程
    python冒泡排序,可对list中的字典进行排序
    python合并list中各个字典中相同条件的累计数
    哎,linux nginx命令就是记不住啊
    python利用urllib2读取webservice接口数据
  • 原文地址:https://www.cnblogs.com/shorfng/p/5133910.html
Copyright © 2011-2022 走看看