1. 程式人生 > >UIResponder【響應】及其分類屬性和方法

UIResponder【響應】及其分類屬性和方法

UIResponder.h

NS_ASSUME_NONNULL_BEGIN

@class UIPress;

@class UIPressesEvent;

@protocol UIResponderStandardEditActions<NSObject>

@optional

//剪下

- (void)cut:(nullableid)senderNS_AVAILABLE_IOS(3_0);

//複製

- (void)copy:(nullableid)senderNS_AVAILABLE_IOS(3_0);

//貼上

- (void)paste:(nullableid)senderNS_AVAILABLE_IOS(3

_0);

//選擇

- (void)select:(nullableid)senderNS_AVAILABLE_IOS(3_0);

//全選

- (void)selectAll:(nullableid)senderNS_AVAILABLE_IOS(3_0);

//刪除

- (void)delete:(nullableid)senderNS_AVAILABLE_IOS(3_2);

//從左到右寫入字串(居左)

- (void)makeTextWritingDirectionLeftToRight:(nullableid)senderNS_AVAILABLE_IOS(5_0);

//從右到左寫入字串(居右)

- (void)makeTextWritingDirectionRightToLeft:(nullable

id)senderNS_AVAILABLE_IOS(5_0);

//切換字型為黑體(粗體)

- (void)toggleBoldface:(nullableid)senderNS_AVAILABLE_IOS(6_0);

//切換字型為斜體

- (void)toggleItalics:(nullableid)senderNS_AVAILABLE_IOS(6_0);

//給文字新增下劃線

- (void)toggleUnderline:(nullableid)senderNS_AVAILABLE_IOS(6_0);

//增加字型大小

- (void)increaseSize:(nullableid)senderNS_AVAILABLE_IOS(7

_0);

//減小字型大小

- (void)decreaseSize:(nullableid)senderNS_AVAILABLE_IOS(7_0);

@end

@interface UIResponder : NSObject<UIResponderStandardEditActions>

#ifUIKIT_DEFINE_AS_PROPERTIES

//下一個響應者

@property(nonatomic,readonly, nullable) UIResponder*nextResponder;

#else

//返回接收下一個響應者,或者nil如果它有沒有。

- (nullableUIResponder*)nextResponder;

#endif

#ifUIKIT_DEFINE_AS_PROPERTIES

//是否可以成為第一個響應者

@property(nonatomic,readonly) BOOLcanBecomeFirstResponder;   // default is NO

#else

//返回一個布林值指出接收者是否可以成為第一個響應者。

- (BOOL)canBecomeFirstResponder;   // default is NO

#endif

//通知接收器,它是即將成為第一響應在其視窗。

- (BOOL)becomeFirstResponder;

#ifUIKIT_DEFINE_AS_PROPERTIES

//是否願意放棄第一響應狀態。

@property(nonatomic,readonly) BOOLcanResignFirstResponder;   // default is YES

#else

//返回一個布林值,指示接收者是否願意放棄第一響應狀態。

- (BOOL)canResignFirstResponder;   // default is YES

#endif

//通知接收器,它已被要求放棄在其視窗第一個響應者的地位。

- (BOOL)resignFirstResponder;

#ifUIKIT_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);

//響應新聞釋出會  ---

//傳送到時,在相關聯的檢視被按壓物理按鈕接收機。

- (void)pressesBegan:(NSSet<UIPress*> *)presses withEvent:(nullable UIPressesEvent *)eventNS_AVAILABLE_IOS(9_0);

//傳送到接收器時,force壓在相關的檢視已經改變。

- (void)pressesChanged:(NSSet<UIPress*> *)presses withEvent:(nullable UIPressesEvent *)eventNS_AVAILABLE_IOS(9_0);

//傳送到接收器時,force壓在相關的檢視已經改變。

- (void)pressesEnded:(NSSet<UIPress*> *)presses withEvent:(nullable UIPressesEvent *)eventNS_AVAILABLE_IOS(9_0);

//送到時,系統事件(例如低記憶體報警)取消了新聞事件的接收器。

- (void)pressesCancelled:(NSSet<UIPress*> *)presses withEvent:(nullable UIPressesEvent *)eventNS_AVAILABLE_IOS(9_0);

//響應運動事件 -----

//告訴一個移動事件已經開始接收器。

- (void)motionBegan:(UIEventSubtype)motionwithEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);

//告訴運動活動已結束的接收器。

- (void)motionEnded:(UIEventSubtype)motionwithEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);

//告訴運動活動已經取消了接收器。

- (void)motionCancelled:(UIEventSubtype)motionwithEvent:(nullable UIEvent *)event NS_AVAILABLE_IOS(3_0);

//響應遠端控制活動----

//傳送到當接收到遠端控制事件的接收機。

- (void)remoteControlReceivedWithEvent:(nullable UIEvent *)eventNS_AVAILABLE_IOS(4_0);

//驗證命令 ----

//請接收響應啟用或在使用者介面中關閉指定的命令。

//通過這個方法告訴UIMenuController它內部應該顯示什麼內容,”複製貼上

- (BOOL)canPerformAction:(SEL)action withSender:(nullableid)senderNS_AVAILABLE_IOS(3_0);

//返回響應的操作目標物件。

//預設的實現是呼叫canPerformAction:withSender:方法來確定物件是否可以呼叫action操作。如果我們想要重寫目標的選擇方式,則應該重寫這個方法。

- (nullable id)targetForAction:(SEL)action withSender:(nullableid)senderNS_AVAILABLE_IOS(7_0);

//獲取撤消經理 ---

//返回響應鏈就近共享撤消管理。

//UIResponder提供了一個只讀方法來獲取響應鏈中共享的undo管理器,公共的事件撤銷管理者

@property(nullable,nonatomic,readonly) NSUndoManager*undoManager NS_AVAILABLE_IOS(3_0);

@end

//響應者支援的快捷鍵

typedef NS_OPTIONS(NSInteger,UIKeyModifierFlags) {

    UIKeyModifierAlphaShift     = 1 <<16// Alppha+Shift

    UIKeyModifierShift          = 1 <<17//Shift

    UIKeyModifierControl        = 1 <<18//Control

    UIKeyModifierAlternate      = 1 <<19//Alt

    UIKeyModifierCommand        = 1 <<20//Command

    UIKeyModifierNumericPad     = 1 <<21//Num

}NS_ENUM_AVAILABLE_IOS(7_0);

@interface UIKeyCommand :NSObject <NSCopying, NSSecureCoding>

- (instancetype)initNS_DESIGNATED_INITIALIZER;

- (nullable instancetype)initWithCoder:(NSCoder*)aDecoder NS_DESIGNATED_INITIALIZER;

//輸入字串

@property (nonatomic,readonly) NSString *input;

//按鍵調節器

@property (nonatomic,readonly) UIKeyModifierFlagsmodifierFlags;

//按指定調節器鍵輸入字串並設定事件

@property (nullable,nonatomic,copy) NSString*discoverabilityTitle NS_AVAILABLE_IOS(9_0);

// The action forUIKeyCommands should accept a single (id)sender, as do theUIResponderStandardEditActions above

// Creates an keycommand that will _not_ be discoverable in the UI.

+ (UIKeyCommand*)keyCommandWithInput:(NSString *)inputmodifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action;

// Key Commands witha discoverabilityTitle _will_ be discoverable in the UI.

+ (UIKeyCommand*)keyCommandWithInput:(NSString *)inputmodifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)actiondiscoverabilityTitle:(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 arrayof UIKeyCommand objects<

@end

@class UIInputViewController;

@class UITextInputMode;

@classUITextInputAssistantItem;

//管理文字輸入模式----

@interface UIResponder(UIResponderInputViewAdditions)

//顯示自定義輸入檢視當接收機成為第一個響應者。//鍵盤輸入檢視(系統預設的,可以自定義)

@property (nullable,nonatomic, readonly,strong) __kindof UIView *inputViewNS_AVAILABLE_IOS(3_2);

//要顯示的自定義輸入附件檢視時,接收器成為第一個響應者。//彈出鍵盤時附帶的檢視

@property (nullable,nonatomic, readonly,strong) __kindof UIView*inputAccessoryView NS_AVAILABLE_IOS(3_2);

//輸入助手配置鍵盤的快捷方式欄時使用。

@property (nonnull,nonatomic, readonly,strong)UITextInputAssistantItem *inputAssistantItem NS_AVAILABLE_IOS(9_0) __TVOS_PROHIBITED__WATCHOS_PROHIBITED;

//當接收機成為第一個響應者使用自定義輸入檢視控制器。

@property (nullable,nonatomic, readonly,strong) UIInputViewController*inputViewController NS_AVAILABLE_IOS(8_0);

//顯示自定義輸入附件檢視控制器當接收機成為第一個響應者。

@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)reloadInputViewsNS_AVAILABLE_IOS(3_2);

@end

// 按鍵輸入箭頭指向

UIKIT_EXTERN NSString *const UIKeyInputUpArrow         NS_AVAILABLE_IOS(7_0);

UIKIT_EXTERN NSString *constUIKeyInputDownArrow      NS_AVAILABLE_IOS(7_0);

UIKIT_EXTERN NSString *constUIKeyInputLeftArrow       NS_AVAILABLE_IOS(7_0);

UIKIT_EXTERN NSString *constUIKeyInputRightArrow     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

相關推薦

UIResponder響應及其分類屬性方法

UIResponder.h NS_ASSUME_NONNULL_BEGIN @class UIPress; @class UIPressesEvent; @protocol UIResponderStandardEditActions<NSObject> @o

Python類的屬性方法的引數加不加self的區別

先看一段程式碼 class Test(object): ID = 1 def __init__(self): pass def prtID(self): print(self.ID) def cl

jQueryjQuery的屬性樣式

注意:jQuery是一個集合,所有很多時候返回值也是一個集合 .attr 1.attr(傳入屬性名) 獲取屬性的值 2.attr(屬性名, 屬性值) 設定屬性的值 3.attr(屬性名,函式值) 設定屬性的函式值 4.attr(attributes) 給指定元

JavaScript常用內建物件及其相應屬性方法(一)

JavaSript物件的型別為Object型別,JavaSript物件分為內建物件和自定義物件。常用的JavaSript內建物件有以下4中:String,Date,Array,Math. String : 主要用於處理字串,常用屬性為length,常用方法如下

PEP 318--函式方法的裝飾器

PEP原文 : https://www.python.org/dev/peps/pep-0318 PEP標題: Decorators for Functions and Methods PEP作者: Kevin D. Smith, Jim J. Jewett, Skip Montanaro, Anthony

WPF關於依賴屬性的ValidateValueCallback,PropertyChangedCallbackCoerceValueCallback的執行順序

value read ado args cep img 強制轉換 .cn clas 三個回調對應依賴屬性的驗證過程,改變過程和強制轉換過程。 class Dobj : DependencyObject { //依賴屬性包裝 public int MyPro

JavaScript 節點操作 以及DOMDocument屬性方法

表示 位置 clas 句柄 doc elements nta XML sele 最近發現DOMDocument對象很重要,還有XMLHTTP也很重要 註意大小寫一定不能弄錯. 屬性: 1Attributes 存儲節點的屬性列表(只讀) 2childNodes 存儲節點的子

Java篇04抽象方法中可以有static屬性方法嗎?小結

抽象方法中可以有Static屬性和方法嗎? 對於這個問題,網上眾說紛紜,其實,抽象類中是可以包含static屬性和static方法的,最典型的例子:Calendar類 下面直接上Calendar類的原始碼: public abstract class Calendar impleme

VUECDN 引入 Axios Qs 及其使用方法

通常一些小型的專案,沒必要大費周章的搭建腳手架,直接以CDN的方式引入vue.js 即可享受到vue的便利性 那麼我們想用到vue中的一些功能,比如axios 呢。 注意:Axios與Qs必須配合使用,否則後臺會拿不到資料 CDN引入: Axios:<script src=

類中特殊的屬性方法掌握

例項屬性和類屬性 例項屬性【物件屬性】和類屬性的區別 ​ a.定義的位置不同:類屬性直接定義在類中,例項屬性定義在建構函式中 ​ b.訪問方式不同:例項屬性必須用物件訪問,類屬性可以使用類名或者物件訪問 ​ c.在記憶體中出現的時機不同:類屬性隨著類的出現而出現,例項屬性隨著物件的出現而出現【在程式碼

JS引用型別中的Function型別——函式屬性方法this,arguments物件;apply(),call方法

一,瞭解函式 1,函式實際是物件,每個函式都是Function型別的例項,而且都與其他引用型別一樣具有屬性和方法,由於函式是物件,因此函式名實際上也是一個指向函式物件的指標,不會與某個函式繫結。 2,函式沒有過載,當聲明瞭兩個同名函式時結果會是後面的函式覆蓋前面的函式。

Pythonpandas-彙總2series常用屬性函式

1.Series常用屬性屬性說明values獲取陣列index獲取索引namevalues的nameindex.name索引的name2.Series常用函式Series可使用ndarray或dict的差不多所有索引操作和函式,集成了ndarray和dict的優點函式說明Se

Kotlin從入門到深坑之類的覆蓋屬性方法以及抽象類

簡介 本篇部落格主要是介紹Kotlin語法中的【類的覆蓋屬性和方法以及抽象類】相關的知識,幫助各位更快的掌握Kotlin,如果有疏漏或者錯誤,請在留言中指正,謝謝。 系列彙總地址 上一篇部落格中我們詳細介紹了類的繼承和構造,下面我們來講一下,在繼承時如何

Java學習筆記66:認識Java中的Reflection(反射)機制,獲取類的屬性方法

反射部分一直欠著,現在學框架和Servlet必須要學一下了。最近學習Struts2框架和Servlet時候,很多地方直接給出類名就可以去使用了,如在web.xml中配置Filter時: <filter> <filter-name&

NetApp使用powershell mountumount Volume

netapp powershell mount-ncvol dismount-ncvol 1)連接DataOntap Cmode控制器 Connect-NCController 10.20.30.40 該IP地址是Cluster 管理地址。2)Mount 現有volumeMount-NcV

javaweb 基礎知識 Tomcat 是什麽

att logic 資源 spa 文件系統 png intra 很快 應用開發 JavaWeb學習總結(一)——JavaWeb開發入門 一、基本概念 1.1、WEB開發的相關知識   WEB,在英語中web即表示網頁的意思,它用於表示Internet主機上供外界訪問的資

MySQL配置MySQL安裝遠程訪問步驟

image 新建 oar 最新 rest word clas 字段 sql安裝 以遠程服務器為例,安裝Mysql到Linux並配置遠程訪問,步驟如下: 1.下載安裝最新的rpm文件 方法一: rpm -Uvh http://repo.mysql.com/mysql-co

Java基本類型引用類型(值傳遞)

適合 and span print pri right bre enc this 【關鍵詞】 【問題】 · 加深對基本類型和引用類型的理解; 【效果圖】 【分析】 參見最後的【參考資料】 【解決方式】 【代碼】 public

轉載Java中ComparableComparator比較

import 比較器 todo itl 復制代碼 ack div array open 【本文轉自】http://www.cnblogs.com/skywang12345/p/3324788.html Comparable 簡介 Comparable 是排序接口。 若一

Java日誌知識總結經常使用組合配置(commons-logging,log4j,slf4j,logback)

ng- binder mono leading black auto erb param 1.2 Log4j Apache的一個開放源碼項目,通過使用Log4j,我們能夠控制日誌信息輸送的目的地是控制臺、文件、GUI組件、甚至是套接口服務 器