通過 Objective-C Runtime, 可以用 Category 方便地添加方法,也可以添加屬性。他的實現原理是對象結構體, objc_class 包含的 methodLists , 是一個二級指針,一個指向指針的指針。 struct objc_method_list **methodLists OBJC2_UNAVAILABLE;// 方法定義的鏈表methodLists表示方法列表,可以動態的修改,實現 Category.參考資料: https://www.jianshu.com/p/c0b...還是有些懵,怎么理解好一些
- 1 回答
- 0 關注
- 612 瀏覽
添加回答
舉報
0/150
提交
取消