IT English Collection (25) of Responder object

2024-05-03 16:32

本文主要是介绍IT English Collection (25) of Responder object,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1 前言

    本文主要介绍了响应对象的相关内容,和事件在响应链上的传递过程。

    转载请注明出处:http://blog.csdn.net/developer_zhang

2 详述

2.1 原文

  A responder is an object that can respond to events and handle them. All responder objects are instances of classes that ultimately inherit from UIResponder (iOS) or NSResponder (OS X). These classes declare a programmatic interface for event handling and define a default behavior for responders. The visible objects of an app are almost always responders—for example, windows, views, and controls—and the app object is a responder as well. In iOS, view controllers (UIViewController objects) are also responder objects.




  To receive events, a responder must implement the appropriate event-handling methods and, in some cases, tell the app that it can become the first responder.

The First Responder Receives Some Events First

  In an app, the responder object that first receives many kinds of events is known as the first responder. It receives key events, motion events, and action messages, among others. (Mouse events and multitouch events first go to the view that is under the mouse pointer or finger; that view might or might not be the first responder.) The first responder is typically the view in a window that an app deems best suited for handling an event. To receive an event, the responder must also indicate its willingness to become first responder; it does this in different ways for each platform:

// OS X
- (BOOL)acceptsFirstResponder { return YES; }//iOS
- (BOOL)canBecomeFirstResponder { return YES; }

  In addition to receiving event messages, a responder can receive action messages that have no target specified. (Action messages are sent by controls such as buttons and controls when users manipulate them.)

The Responder Chain Enables Cooperative Event Handling
 

  If the first responder cannot handle an event or action message, it forwards it to the “next responder” in a linked series called the responder chain. The responder chain allows responder objects to transfer responsibility for handling an event or action message to other objects in the app. If an object in the responder chain cannot handle the event or action, it passes the message to the next responder in the chain. The message travels up the chain, toward higher-level objects, until it is handled. If it isn't handled, the app discards it.


Figure 17-1  The responder chain for iOS (left) and OS X (right)


The path of an event. The general path of an event up the responder chain starts with a view—the first responder or the view under the mouse pointer or finger. From there, it proceeds up the view hierarchy to the window object and then to the global app object. However, the responder chain for events in iOS adds a variation to this path: If a view is managed by a view controller and if the view cannot handle an event, the view controller becomes the next responder.

  The path of an action message. For action messages, both OS X and iOS extend the responder chain to other objects. In OS X, the responder chain for action messages differs for an app based on the document architecture, an app that uses window controllers (NSWindowController), and an app that fits neither of those categories. Additionally, if an app on OS X has both a key window and a main window, the responder chain along which an action message travels might involve the view hierarchies of both windows.

2.2 生词

ultimately ['ʌltɪmətlɪ]adv. 最后;根本;基本上

inherit [ɪn'herɪt]vt. 继承;遗传而得

programmatic [prəʊɡrə'mætɪk]adj. 节目的;标题音乐的,纲领性

appropriate [ə'prəʊprɪət]adj. 适当的

in some cases在某些情况下;有时候

motion ['məʊʃ(ə)n]n. 动作;移动;

deems [diːm]vt. 认为,视作;相信

suited ['suːtɪd]adj. 合适的

indicate ['ɪndɪkeɪt]vt. 表明;指出;预示;象征

willingness ['wɪlɪŋnɪs]n. 乐意;心甘情愿;自动自发

platform ['plætfɔːm]n. 平台;月台,站台;坛;讲台

in addition to 之外

manipulate [mə'nɪpjʊleɪt]vt. 操纵;操作

Cooperative [kəʊ'ɒpərətɪv]adj. 合作的;合作社的

forwards ['fɔːwədz]adv. 向前;今后

series ['sɪəriːz; -rɪz]n. 系列,连续;[电] 串联;级数;丛书

responsibility [rɪ,spɒnsɪ'bɪlɪtɪ]n. 责任,职责;义务

discardsv. 丢弃

general ['dʒen(ə)r(ə)l]adj. 一般的,普通的;综合的;大体的

proceed [prə'siːd]vi. 开始;继续进行;发生;行进

variation [veərɪ'eɪʃ(ə)n]n. 变化;[生物] 变异,变种

extend [ɪk'stend; ek-]vt. 延伸;扩大;推广;

architecture ['ɑːkɪtektʃə]n. 建筑学;建筑风格;建筑式样

categories ['kætɪg(ə)rɪz]n. 类别(category的复数);分类

additionally [ə'dɪʃənəlɪ]adv. 此外;又,加之

involve [ɪn'vɒlv]vt. 包含;牵涉;使陷于;潜心于

3 结语

  以上是所有内容,希望对大家有所帮助。

这篇关于IT English Collection (25) of Responder object的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/957156

相关文章

Java中Object类的常用方法小结

《Java中Object类的常用方法小结》JavaObject类是所有类的父类,位于java.lang包中,本文为大家整理了一些Object类的常用方法,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1. public boolean equals(Object obj)2. public int ha

五大特性引领创新! 深度操作系统 deepin 25 Preview预览版发布

《五大特性引领创新!深度操作系统deepin25Preview预览版发布》今日,深度操作系统正式推出deepin25Preview版本,该版本集成了五大核心特性:磐石系统、全新DDE、Tr... 深度操作系统今日发布了 deepin 25 Preview,新版本囊括五大特性:磐石系统、全新 DDE、Tree

深入探讨Java 中的 Object 类详解(一切类的根基)

《深入探讨Java中的Object类详解(一切类的根基)》本文详细介绍了Java中的Object类,作为所有类的根类,其重要性不言而喻,文章涵盖了Object类的主要方法,如toString()... 目录1. Object 类的基本概念1.1 Object 类的定义2. Object 类的主要方法3. O

Collection List Set Map的区别和联系

Collection List Set Map的区别和联系 这些都代表了Java中的集合,这里主要从其元素是否有序,是否可重复来进行区别记忆,以便恰当地使用,当然还存在同步方面的差异,见上一篇相关文章。 有序否 允许元素重复否 Collection 否 是 List 是 是 Set AbstractSet 否

【Python报错已解决】AttributeError: ‘list‘ object has no attribute ‘text‘

🎬 鸽芷咕:个人主页  🔥 个人专栏: 《C++干货基地》《粉丝福利》 ⛺️生活的理想,就是为了理想的生活! 文章目录 前言一、问题描述1.1 报错示例1.2 报错分析1.3 解决思路 二、解决方法2.1 方法一:检查属性名2.2 步骤二:访问列表元素的属性 三、其他解决方法四、总结 前言 在Python编程中,属性错误(At

浅谈PHP5中垃圾回收算法(Garbage Collection)的演化

前言 PHP是一门托管型语言,在PHP编程中程序员不需要手工处理内存资源的分配与释放(使用C编写PHP或Zend扩展除外),这就意味着PHP本身实现了垃圾回收机制(Garbage Collection)。现在如果去PHP官方网站(php.net)可以看到,目前PHP5的两个分支版本PHP5.2和PHP5.3是分别更新的,这是因为许多项目仍然使用5.2版本的PHP,而5.3版本对5.2并不是完

【JavaScript】LeetCode:21-25

文章目录 21 最大子数组和22 合并区间23 轮转数组24 除自身以外数组的乘积25 缺失的第一个正数 21 最大子数组和 贪心 / 动态规划贪心:连续和(count)< 0时,放弃当前起点的连续和,将下一个数作为新起点,这里提供使用贪心算法解决本题的代码。动态规划:dp[i]:以nums[i]为结尾的最长连续子序列(子数组)和。 dp[i] = max(dp[i - 1]

Collection的所有的方法演示

import java.util.ArrayList;import java.util.Collection;import java.util.Iterator;public class TestCollection {/*** @param args* Collection的所有的方法演示* 此程序没有使用泛型,所以可以添加任意类型* 以后如果写到泛型会补充这一方面的内容*/public s

error while loading shared libraries: libnuma.so.1: cannot open shared object file:

腾讯云CentOS,安装Mysql时: 1.yum remove libnuma.so.1 2.yum install numactl.x86_64

2025年25届计算机毕业设计:如何实现高校实验室Java SpringBoot教学管理系统

✍✍计算机毕业编程指导师** ⭐⭐个人介绍:自己非常喜欢研究技术问题!专业做Java、Python、微信小程序、安卓、大数据、爬虫、Golang、大屏等实战项目。 ⛽⛽实战项目:有源码或者技术上的问题欢迎在评论区一起讨论交流! ⚡⚡ Java、Python、微信小程序、大数据实战项目集 ⚡⚡文末获取源码 文章目录 ⚡⚡文末获取源码高校实验室教学管理系统-研究背景高校实验室教学管理系