#import <Foundation/Foundation.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UIEvent.h>
#import <UIKit/UIPasteConfigurationSupporting.h> NS_ASSUME_NONNULL_BEGIN @class UIPress;
@class UIPressesEvent;
//响应者类的按键命令类类目
@protocol UIResponderStandardEditActions <NSObject>
@optional
- (void)cut:(nullable id)sender NS_AVAILABLE_IOS(3_0);//剪切
- (void)copy:(nullable id)sender NS_AVAILABLE_IOS(3_0);//复制
- (void)paste:(nullable id)sender NS_AVAILABLE_IOS(3_0);//粘贴
- (void)select:(nullable id)sender NS_AVAILABLE_IOS(3_0);//选择
- (void)selectAll:(nullable id)sender NS_AVAILABLE_IOS(3_0);//选择全部
- (void)delete:(nullable id)sender NS_AVAILABLE_IOS(3_2);//删除
- (void)makeTextWritingDirectionLeftToRight:(nullable id)sender NS_AVAILABLE_IOS(5_0);//从左到右写入字符串
- (void)makeTextWritingDirectionRightToLeft:(nullable id)sender NS_AVAILABLE_IOS(5_0);//从右到左写入字符串
- (void)toggleBoldface:(nullable id)sender NS_AVAILABLE_IOS(6_0);//切换字体为黑体
- (void)toggleItalics:(nullable id)sender NS_AVAILABLE_IOS(6_0);//切换字体为斜体
- (void)toggleUnderline:(nullable id)sender NS_AVAILABLE_IOS(6_0);//为字体加入下划线 - (void)increaseSize:(nullable id)sender NS_AVAILABLE_IOS(7_0);//增加字体大小
- (void)decreaseSize:(nullable id)sender NS_AVAILABLE_IOS(7_0);//减小字体大小 @end NS_CLASS_AVAILABLE_IOS(2_0) @interface UIResponder : NSObject <UIResponderStandardEditActions>
//响应链中负责传递事件的方法
#if UIKIT_DEFINE_AS_PROPERTIES
@property(nonatomic, readonly, nullable) UIResponder *nextResponder;
#else
- (nullable UIResponder*)nextResponder;
#endif //一个响应对象是否可以成为第一响应者,可以用这个进行判断,默认值为NO
#if UIKIT_DEFINE_AS_PROPERTIES
@property(nonatomic, readonly) BOOL canBecomeFirstResponder; // default is NO
#else
- (BOOL)canBecomeFirstResponder; // default is NO
#endif
//设置对象成为第一响应者,成功返回YES;否则返回NO
- (BOOL)becomeFirstResponder; //是否可以辞去第一响应者,默认值为YES
#if UIKIT_DEFINE_AS_PROPERTIES
@property(nonatomic, readonly) BOOL canResignFirstResponder; // default is YES
#else
- (BOOL)canResignFirstResponder; // default is YES
#endif
//辞去第一响应者 成功返回YES;否则返回NO
- (BOOL)resignFirstResponder; //判定一个响应对象是否是第一响应者
#if UIKIT_DEFINE_AS_PROPERTIES
@property(nonatomic, readonly) BOOL isFirstResponder;
#else
- (BOOL)isFirstResponder;
#endif //响应触摸事件
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;//手指按下的时候调用
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;//手指移动的时候调用
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;//手指抬起的时候调用
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event;//取消(非正常离开屏幕,意外中断)
- (void)touchesEstimatedPropertiesUpdated:(NSSet<UITouch *> *)touches NS_AVAILABLE_IOS(9_1);// Apple Pencil 产生的 touch 事件的部分信息(如 Pencil 的方向等)传递到 iPad 或 iPhone 上会有一定的延时。
//UIKit 的回调方法 touchBegan 是立即产生的,其返回的参数 touch 中包含了 Pencil 产生的额外信息,这个额外信息是有延时的。所以,首次回调时会给出额外信息的预估值,延时获取真实值之后会调用 touchesEstimatedPropertiesUpdated 方法更新额外信息。 //物理按钮 深按API,一般用于遥控器
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(nullable UIPressesEvent *)event NS_AVAILABLE_IOS(9_0);// 开始按压的时候调用
- (void)pressesChanged:(NSSet<UIPress *> *)presses withEvent:(nullable UIPressesEvent *)event NS_AVAILABLE_IOS(9_0);// 按压改变的时候调用
- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(nullable UIPressesEvent *)event NS_AVAILABLE_IOS(9_0);// 按压结束的时候调用
- (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(nullable UIPressesEvent *)event NS_AVAILABLE_IOS(9_0);// 当系统发出取消按压事件的时候调用 //响应移动事件
- (void)motionBegan:(UIEventSubtype)motion withEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);//移动事件开始
- (void)motionEnded:(UIEventSubtype)motion withEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);//移动事件结束
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);//移动事件取消 //响应远程控制事件 一般用于耳机
- (void)remoteControlReceivedWithEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(4_0); //通过这个方法告诉UIMenuController它内部应该显示什么内容,”复制”、”粘贴”等
- (BOOL)canPerformAction:(SEL)action withSender:(nullable id)sender NS_AVAILABLE_IOS(3_0);
////默认的实现是调用canPerformAction:withSender:方法来确定对象是否可以调用action操作。如果我们想要重写目标的选择方式,则应该重写这个方法。
- (nullable id)targetForAction:(SEL)action withSender:(nullable id)sender NS_AVAILABLE_IOS(7_0); //UIResponder提供了一个只读方法来获取响应链中共享的undo管理器,公共的事件撤销管理者
@property(nullable, nonatomic,readonly) NSUndoManager *undoManager NS_AVAILABLE_IOS(3_0); @end //定义一个响应者支持的快捷键
typedef NS_OPTIONS(NSInteger, UIKeyModifierFlags) {
UIKeyModifierAlphaShift = << ,// Alppha+Shift键
UIKeyModifierShift = << ,//Shift键
UIKeyModifierControl = << ,//Control键
UIKeyModifierAlternate = << ,//Alt键
UIKeyModifierCommand = << ,//Command键
UIKeyModifierNumericPad = << ,//Num键
} NS_ENUM_AVAILABLE_IOS(7_0); NS_CLASS_AVAILABLE_IOS(7_0) @interface UIKeyCommand : NSObject <NSCopying, NSSecureCoding> - (instancetype)init NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
//输入字符串
@property (nullable,nonatomic,readonly) NSString *input;
//按键调节器
@property (nonatomic,readonly) UIKeyModifierFlags modifierFlags;
//按指定调节器键输入字符串并设置事件
@property (nullable,nonatomic,copy) NSString *discoverabilityTitle NS_AVAILABLE_IOS(9_0); // The action for UIKeyCommands should accept a single (id)sender, as do the UIResponderStandardEditActions above // Creates an key command that will _not_ be discoverable in the UI.
+ (UIKeyCommand *)keyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action; // Key Commands with a discoverabilityTitle _will_ be discoverable in the UI.
+ (UIKeyCommand *)keyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle NS_AVAILABLE_IOS(9_0); @end @interface UIResponder (UIResponderKeyCommands)
@property (nullable,nonatomic,readonly) NSArray<UIKeyCommand *> *keyCommands NS_AVAILABLE_IOS(7_0); // returns an array of UIKeyCommand objects<
@end @class UIInputViewController;
@class UITextInputMode;
@class UITextInputAssistantItem; @interface UIResponder (UIResponderInputViewAdditions) //键盘输入视图(系统默认的,可以自定义)
@property (nullable, nonatomic, readonly, strong) __kindof UIView *inputView NS_AVAILABLE_IOS(3_2);
//弹出键盘时附带的视图
@property (nullable, nonatomic, readonly, strong) __kindof UIView *inputAccessoryView NS_AVAILABLE_IOS(3_2); /// This method is for clients that wish to put buttons on the Shortcuts Bar, shown on top of the keyboard.
/// You may modify the returned inputAssistantItem to add to or replace the existing items on the bar.
/// Modifications made to the returned UITextInputAssistantItem are reflected automatically.
/// This method should not be overriden. Goes up the responder chain.
@property (nonnull, nonatomic, readonly, strong) UITextInputAssistantItem *inputAssistantItem NS_AVAILABLE_IOS(9_0) __TVOS_PROHIBITED __WATCHOS_PROHIBITED; //键盘输入视图控制器 IOS8以后
@property (nullable, nonatomic, readonly, strong) UIInputViewController *inputViewController NS_AVAILABLE_IOS(8_0);
//弹出键盘时附带的视图的视图控制器 IOS8以后
@property (nullable, nonatomic, readonly, strong) UIInputViewController *inputAccessoryViewController NS_AVAILABLE_IOS(8_0); //文本输入模式
@property (nullable, nonatomic, readonly, strong) UITextInputMode *textInputMode NS_AVAILABLE_IOS(7_0);
//文本输入模式标识
@property (nullable, nonatomic, readonly, strong) NSString *textInputContextIdentifier NS_AVAILABLE_IOS(7_0);
//根据设置的标识清除指定的文本输入模式
+ (void)clearTextInputContextIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(7_0); //重新刷新键盘输入视图
- (void)reloadInputViews NS_AVAILABLE_IOS(3_2); @end // 按键输入箭头指向
UIKIT_EXTERN NSString *const UIKeyInputUpArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputDownArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputLeftArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputRightArrow NS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN NSString *const UIKeyInputEscape NS_AVAILABLE_IOS(7_0); @interface UIResponder (ActivityContinuation)
//用户活动
@property (nullable, nonatomic, strong) NSUserActivity *userActivity NS_AVAILABLE_IOS(8_0);
//更新用户活动
- (void)updateUserActivityState:(NSUserActivity *)activity NS_AVAILABLE_IOS(8_0);
//恢复用户活动
- (void)restoreUserActivityState:(NSUserActivity *)activity NS_AVAILABLE_IOS(8_0);
@end #if TARGET_OS_IOS
@interface UIResponder (UIPasteConfigurationSupporting) <UIPasteConfigurationSupporting>
@end
#endif NS_ASSUME_NONNULL_END

iOS开发UIResponder简介API的更多相关文章

  1. iOS开发之多媒体API(1)

    iOS开发之多媒体API(1)       播放视频 视频文件介绍 视频格式可以分为适合本地播放的本地影像视频和适合在网络中播放的网络流媒体影像视频两大类.尽管后者在播放的稳定性和播放画面质量上可能没 ...

  2. iOS开发UITouch触摸API简介

    1.UITouch简介 当用户触摸屏幕时,会创建一个UITouch对象: UITouch的作用保存着触摸相关的信息,比如触摸的位置.时间.阶段等: 当从开始到结束,系统会更新UITouch对象,结束时 ...

  3. iOS开发UIResponder之NSUndoManager

    1.简介 UIResponder有个属性:NSUndoManager @property(nullable, nonatomic,readonly) NSUndoManager *undoManage ...

  4. iOS开发之多媒体API (转载)

    视频格式可以分为适合本地播放的本地影像视频和适合在网络中播放的网络流媒体影像视频两大类.尽管后者在播放的稳定性和播放画面质量上可能没有前者 优秀,但网络流媒体影像视频的广泛传播性使之正被广泛应用于视频 ...

  5. iOS开发之多媒体API

    播放视频 视频文件介绍 视频格式可以分为适合本地播放的本地影像视频和适合在网络中播放的网络流媒体影像视频两大类.尽管后者在播放的稳定性和播放画面质量上可能没有前者 优秀,但网络流媒体影像视频的广泛传播 ...

  6. iOS开发-多线程简介

    多线程从概念上理解是指从软件或者硬件上实现多个线程并发执行的技术,简单点理解就是同一时间可以执行多个事情(比如说一边听歌一边码代码),听歌是一个线程,码代码是一个线程,如果是单核CPU的话,上面两个动 ...

  7. iOS开发中的Html解析方法

    iOS开发中的Html解析方法 本文作者为大家介绍了在iOS开发中的Html解析方法,并同时提供了Demo代码的下载链接,Demo 解析了某个网站(具体可在代码中查看)的html网页,提取了图片以及标 ...

  8. iOS开发-Objective-C Block的实现方式

    前言:我们可以把Block当作一个闭包函数,它可以访问外部变量和局部变量,但默认是不可以修改外部变量.你可以使用它来做回调方法,比起使用代理(Delegate)会更加直观.顺带一提,苹果很多的接口(A ...

  9. iOS开发UI篇—核心动画简介

    转自:http://www.cnblogs.com/wendingding/p/3801036.html iOS开发UI篇—核心动画简介 一.简单介绍 Core Animation,中文翻译为核心动画 ...

随机推荐

  1. HTML-参考手册: Px、Em 换算工具

    ylbtech-HTML-参考手册: Px.Em 换算工具 1.返回顶部 1. Px.Em 换算工具 以下工具提供了em和px的换算工具. 第一个输入框:设置了网页默认的字体像素 (通常 16px) ...

  2. (动态改变数据源遇到的问题)ORACLE11g:No Dialect mapping for JDBC type: -9解决方案

    在动态改变数据源时 hibernate配置不能使用Oracle官方的方言(org.hibernate.dialect.Oracle10gDialect) 做法写一个方言扩展类,缺什么类型,添加什么类型 ...

  3. CentOS 安装MySQL(rpm)提示错误Header V3 DSA/SHA1 Signature

    提示错误:Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies 错误原因:这是由于yum安装了 ...

  4. 分析由Python编写的大型项目(Volatility和Cuckoo)

    之前使用python都是用来做一些简单的脚本,本质上和bat批处理文件没有区别. 但是Python是可以用来编写大型的项目的,比如: Volatility:https://code.google.co ...

  5. HDU 6685 Rikka with Coin (枚举 思维)

    2019 杭电多校 9 1006 题目链接:HDU 6685 比赛链接:2019 Multi-University Training Contest 9 Problem Description Rik ...

  6. mysql优化1:建表原则

    建表三大原则: 定长和变长分离 常用字段和不常用字段分离 使用冗余字段或冗余表 1.定长与变长分离 如 id int,占4个字节,char(4)占4个字符长度,也是定长,time 即每一个单元值占的字 ...

  7. 并发编程(六)——进程/线程池、协程、gevent第三方库

    进程/线程池.协程.gevent第三方库 一.进程/线程池 1.进程池 (1)什么是进程池 如果需要创建的子进程数量不大,可以直接利用multiprocess中的Process来创建.但是当需要创建上 ...

  8. jQuery中html()再探究(转载)

    我们先来看段代码,很简单,如下: /*html部分*/ <div id="div1"> <span>111</span> <span> ...

  9. es概念一句话简介和注意点

    1.elasticsearch是什么? 一个实时分布式搜索(全文or结构化)和分析引擎,面向文档(document oriented) 2.主节点(Master Node)职责? 负责集群中的操作(如 ...

  10. 第十八天:CSV、JSON、Excel、SQLite

    一.CSV文件 1.读取 reader = csv.reader(打开的file对象), reader为可迭代对象 2.用namedtuple映射列名 with open('apple.csv') a ...