KVO VS isa : KVO 建立在 KVC 之上
Key-Value Observing (KVO) 建立在 KVC 之上,它通过重写 KVC 和监听 setter 方法,向外发送通知。
https://blog.csdn.net/y550918116j/article/details/64906862
猜测:KVO 保留的原来的类引用,用于返回class值;
(lldb) po self.scrollView.class
UITableView
(lldb) po self.scrollView->isa
NSKVONotifying_UITableView
Automatic key-value observing is implemented using a technique called isa-swizzling.
The isa pointer, as the name suggests, points to the object's class which maintains a dispatch table. This dispatch table essentially contains pointers to the methods the class implements, among other data.
When an observer is registered for an attribute of an object the isa pointer of the observed object is modified, pointing to an intermediate class rather than at the true class. As a result the value of the isa pointer does not necessarily reflect the actual class of the instance.
You should never rely on the isa pointer to determine class membership. Instead, you should use the class method to determine the class of an object instance.
- class
{
return (id)isa;
}
KVO VS isa : KVO 建立在 KVC 之上的更多相关文章
- 深入理解 KVC\KVO 实现机制 — KVO
KVC和KVO都属于键值编程而且底层实现机制都是isa-swizzing,所以本来想放在一起讲的.但是篇幅有限所以就分成了两篇博文. KVC实现机制传送门 KVO概述 键值观察Key-Value-Ob ...
- iOS - 详细理解KVC与KVO
详细理解KVC与KVO 在面试的时候,KVC与KVO有些时候还是会问到的,并且他们都是Objective C的关键概念,在这里我们先做一个简单地介绍: (一)KVC: KVC即指:NSKeyValue ...
- KVC 与 KVO
一.Key-Value Coding (KVC)键值编码 KVC,即是指 NSKeyValueCoding,一个非正式的 Protocol,提供一种机制来间接访问对象的属性.KVO 就是基于 KVC ...
- KVC 与 KVO 理解
KVC 与 KVO 是 Objective C 的关键概念,个人认为必须理解的东西,下面是实例讲解. Key-Value Coding (KVC) KVC,即是指 NSKeyValueCoding,一 ...
- KVC和KVO的区别
kvc和kvo 1.kvc Key-Value Coding (KVC) KVC,即是指 NSKeyValueCoding,一个非正式的 Protocol,提供一种机制来间接访问对象的属性.KVO 就 ...
- KVO与KVC初步了解
参考: http://magicalboy.com/kvc_and_kvo/ http://www.mamicode.com/info-detail-515516.html KVC,即是指 NSKey ...
- KVC 与 KVO 理解-b
KVC 与 KVO 是 Objective C 的关键概念,个人认为必须理解的东西,下面是实例讲解. Key-Value Coding (KVC) KVC,即是指 NSKeyValueCoding,一 ...
- KVC与KVO的理解
KVC与KVO是Objective C的关键概念. Key—Value Coding (KVC) 即是指NSKeyValueCoding,一个非正式的Protocol,提供一种机制间接访问对象的属性. ...
- [转] iOS (OC) 中 KVC 与 KVO 理解
转自: http://magicalboy.com/kvc_and_kvo/ KVC 与 KVO 是 Objective C 的关键概念,个人认为必须理解的东西,下面是实例讲解. Key-Value ...
随机推荐
- WebView简单用法
1.空布局 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:andr ...
- CREATE TABLE 语句后的 ON [PRIMARY] 起什么作用
CREATE TABLE [dbo].[table1] ( [gh] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ...
- LeetCode(96)Unique Binary Search Trees
题目如下: Python代码: def numTrees(self, n): """ :type n: int :rtype: int """ ...
- 陆、jq基础语法
一.概述:更加方便的处理html文档.events事件.动画效果和ajax交互等. 1.jq主要功能: (1)访问页面框架的局部. (2)修改页面表现 (3)更改页面的内容 (4)响应事件 (5)为页 ...
- CF960F Pathwalks_权值线段树_LIS
很不错的一道思维题. Code: #include<cstdio> #include<algorithm> #include<iostream> using nam ...
- make 编译 linux 内核是单线程的任务 才用-j4命令使用4 线程加速
今天使用 make 编译 linux 内核,发现CPU只用了30%多一点,而我的电脑是4核的,所以如果没有意外的话,make 编译 linux 内核的任务是用单线程做的. 又了解到,使用-j4参数可以 ...
- C IO programming test code
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl ...
- npx命令
npx命令 查了一下, 英文资料: https://www.npmjs.com/package/npx 中文资料: 什么是npx 第一次看到npx命令是在 babel 的文档里 Note: If yo ...
- spring mvc 下载
1.代码: response.setContentType("application/msword;charset=GBK"); try { response.setHeader( ...
- async、await 优缺点
async.await 优缺点 async 和 await 相比直接使用 Promise 来说,优势在于处理 then 的调用链,能够更清晰准确的写出代码.缺点在于滥用 await 可能会导致性能问题 ...