美文网首页
isa 指针学习

isa 指针学习

作者: Taoai_M | 来源:发表于2018-04-17 15:21 被阅读3次

Every object has an isa instance variable that identifies the object's class. The runtime uses this pointer to determine the actual class of the object when it needs to.

每个对象都有一个isa实例变量来标识对象的类。运行时使用这个指针来确定对象的实际类别。

当一个子类执行分类中的方法时,如果在子类中没找到方法名,回去寻找父类以及根类中的方法。

runtime动态运行时理解

objc_ivar 成员变量 (可动态获取类中的成员变量)

objc_method 类的方法名 (可动态获取某个类的所有类方法)

objc_category 类别  (可通过类别为某个类动态添加方法和属性)

objc_property  属性 (可属性获取类中的所有属性,通过for循环将属性值反射数组,字典,或者json数据)

相关文章

网友评论

      本文标题:isa 指针学习

      本文链接:https://www.haomeiwen.com/subject/vrgukftx.html