2020年12月2日

018*:kvo:(context、kvo合规【kvc基础上】)(isa-swizzling kvo派生类 NSKVONotifying_本类名)(重写setter、class、dealloc、_isKVOA)(重写set【手动开启通知、修改isa】、class、malloc【修改isa】)

摘要: 问题 目录 预备 1:测试代码:(监听person对象的name属性的新值) // HTPerson @interface HTPerson : NSObject @property (nonatomic, copy) NSString *name; @end @implementation HTP 阅读全文

posted @ 2020-12-02 23:55 风zk 阅读(168) 评论(0) 推荐(0) 编辑

017*:kvc原理 :(赋值和取值【_key,_iskey,key,iskey】(【路由、模型转换、私有变量】)

摘要: 问题 目录 1、定义 2、KVC 相关方法 3、赋值的策略 预备 1: 定义基本的方法 @interface LPPerson : NSObject{ @public NSString *_isName; NSString *name; NSString *isName; NSString *_na 阅读全文

posted @ 2020-12-02 23:52 风zk 阅读(299) 评论(0) 推荐(0) 编辑

016*:方法交换Method-Swizzling?(1:一次性问题:load或者initialize 2: 子类不和父类方法。)

摘要: 问题 1:一次性问题:load或者initialize 2: 子类不和父类方法。 目录 1:method-swizzling 是什么? 2:注意: 3:method-swizzling - 类方法 4:method-swizzling的应用 预备 测试代码:HTRuntimeTool类:负责方法交换 阅读全文

posted @ 2020-12-02 23:50 风zk 阅读(193) 评论(0) 推荐(0) 编辑

015*:面试题

摘要: 一:Runtime Asssociate方法关联的对象,需要在dealloc中释放? 不需要 当我们对象释放时,会调用dealloc 1、C++函数释放 :objc_cxxDestruct 2、移除关联属性:_object_remove_assocations 3、将弱引用自动设置nil:weak_ 阅读全文

posted @ 2020-12-02 22:52 风zk 阅读(94) 评论(0) 推荐(0) 编辑

014*:分类和类扩展和关联属性-(AssociationsHashMap-ObjectAssociationMap)

摘要: 关联对象本质 关联对象底层实现:**其实就是两层哈希map , 存取的时候两层处理**。 第一层:类名object:bucket【AssociationsHashMap】 第二层:key:ObjcAssociation(value和policy)【ObjectAssociationMap】 1: C 阅读全文

posted @ 2020-12-02 19:31 风zk 阅读(279) 评论(0) 推荐(0) 编辑

013:分类的加载:realizeClassWithoutSwift -> methodizeClass -> attachToClass ->load_categories_nolock->attachCategories, loadImage的加载

摘要: 问题 懒加载分类会在编译器把数据加载 只要有非懒加载分类会走attachCategories来加载分类数据 1:methodizeClass内部有对分类的处理 2:attachToClass 3:attachCategories函数:绑定分类。 4:extAllocIfNeeded:-> extAl 阅读全文

posted @ 2020-12-02 17:10 风zk 阅读(212) 评论(0) 推荐(0) 编辑

012:类的加载上:mapImage-[readClass->UnfixedSelectors->readProtocol]->realizeClassWithoutSwift->[methodizeClass->prepareMethodLists->fixupMethodList]->attachCategories)、loadImage(加载load方法),

摘要: 问题 readImage->(readClass->UnfixedSelectors->readProtocol)->realizeClassWithoutSwift->methodizeClass->attachCategories) 1: readImage 2:readClass->Unfix 阅读全文

posted @ 2020-12-02 13:36 风zk 阅读(224) 评论(0) 推荐(0) 编辑

011:dyld和objc的关联-(_dyld_objc_notify_register-registerObjCNotifiers-sNotifyObjCInit-map_images-load_images-unmap_image)

摘要: 问题 目录 预备 正文 一:_objc_init 源码解析 void _objc_init(void) { static bool initialized = false; if (initialized) return; initialized = true; // fixme defer ini 阅读全文

posted @ 2020-12-02 10:57 风zk 阅读(195) 评论(0) 推荐(0) 编辑

导航