博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
KVO VS isa
阅读量:7057 次
发布时间:2019-06-28

本文共 884 字,大约阅读时间需要 2 分钟。

猜测: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  method to determine the class of an object instance.

 

- class{	return (id)isa; }

转载地址:http://drrol.baihongyu.com/

你可能感兴趣的文章
linux操作系统的目录以及用户权权限的管理
查看>>
GAN
查看>>
文件操作
查看>>
吃货联盟项目
查看>>
设计模式建造者
查看>>
基于XMPP实现的Openfire的配置安装+Android客户端的实现[转]
查看>>
android学习博客
查看>>
Linux下脚本实现交互输入
查看>>
Dapper 存储过程、事务等
查看>>
汇编语言-深入机器的内核
查看>>
Eclipse对于多个Java项目的支持并不友好!
查看>>
Pandas Series数据结构基本操作
查看>>
ubuntu桌面环境配置及切换
查看>>
oracle常用查询三
查看>>
码字定式之SQL(6)
查看>>
命名空间“Microsoft”中不存在类型或命名空间名“Reporting”(是否缺少程序集引用?)...
查看>>
【转】Scheme 编程环境的设置
查看>>
异常分类,异常抛出位置
查看>>
需求分析与原型设计
查看>>
敌兵布阵 HDU - 1166 (树状数组模板题,线段树模板题)
查看>>