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数据)
网友评论