傳送門?
objc_
class_
object_
method_
property_
protocol_
ivar_ ,sel_ ,imp_
1.objc_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
objc_getClass獲取Class對象
objc_getMetaClass獲取MetaClass對象
objc_allocateClassPair分配空間,創(chuàng)建類(僅在 創(chuàng)建之后,注冊之前 能夠添加成員變量)
objc_registerClassPair注冊一個(gè)類(注冊后方可使用該類創(chuàng)建對象)
objc_disposeClassPair注銷某個(gè)類
objc_allocateProtocol開辟空間創(chuàng)建協(xié)議
objc_registerProtocol注冊一個(gè)協(xié)議
objc_constructInstance構(gòu)造一個(gè)實(shí)例對象(ARC下無效)
objc_destructInstance析構(gòu)一個(gè)實(shí)例對象(ARC下無效)
objc_setAssociatedObject為實(shí)例對象關(guān)聯(lián)對象
objc_getAssociatedObje*ct獲取實(shí)例對象的關(guān)聯(lián)對象
objc_removeAssociatedObjects清空實(shí)例對象的所有關(guān)聯(lián)對象
objc_msgSend發(fā)送ObjC消息
-
objc_系列函數(shù)關(guān)注于宏觀使用,如類與協(xié)議的空間分配,注冊,注銷等操作
2.class_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
class_addIvar為類添加實(shí)例變量
class_addProperty為類添加屬性
class_addMethod為類添加方法
class_addProtocol為類遵循協(xié)議
class_replaceMethod替換類某方法的實(shí)現(xiàn)
class_getName獲取類名
class_isMetaClass判斷是否為元類
objc_getProtocol獲取某個(gè)協(xié)議
objc_copyProtocolList拷貝在運(yùn)行時(shí)中注冊過的協(xié)議列表
class_getSuperclass獲取某類的父類
class_setSuperclass設(shè)置某類的父類
class_getProperty獲取某類的屬性
class_getInstanceVariable獲取實(shí)例變量
class_getClassVariable獲取類變量
class_getInstanceMethod獲取實(shí)例方法
class_getClassMethod獲取類方法
class_getMethodImplementation獲取方法的實(shí)現(xiàn)
class_getInstanceSize獲取類的實(shí)例的大小
class_respondsToSelector判斷類是否實(shí)現(xiàn)某方法
class_conformsToProtocol判斷類是否遵循某協(xié)議
class_createInstance創(chuàng)建類的實(shí)例
class_copyIvarList拷貝類的實(shí)例變量列表
class_copyMethodList拷貝類的方法列表
class_copyProtocolList拷貝類遵循的協(xié)議列表
class_copyPropertyList拷貝類的屬性列表
-
class_系列函數(shù)關(guān)注于類的內(nèi)部,如實(shí)例變量,屬性,方法,協(xié)議等相關(guān)問題
3.object_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
object_copy對象copy(ARC無效)
object_dispose對象釋放(ARC無效)
object_getClassName獲取對象的類名
object_getClass獲取對象的Class
object_setClass設(shè)置對象的Class
object_getIvar獲取對象中實(shí)例變量的值
object_setIvar設(shè)置對象中實(shí)例變量的值
object_getInstanceVariable獲取對象中實(shí)例變量的值 (ARC中無效,使用object_getIvar)
object_setInstanceVariable設(shè)置對象中實(shí)例變量的值 (ARC中無效,使用object_setIvar)
-
objcet_系列函數(shù)關(guān)注于對象的角度,如實(shí)例變量
4.method_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
method_getName獲取方法名
method_getImplementation獲取方法的實(shí)現(xiàn)
method_getTypeEncoding獲取方法的類型編碼
method_getNumberOfArguments獲取方法的參數(shù)個(gè)數(shù)
method_copyReturnType拷貝方法的返回類型
method_getReturnType獲取方法的返回類型
method_copyArgumentType拷貝方法的參數(shù)類型
method_getArgumentType獲取方法的參數(shù)類型
method_getDescription獲取方法的描述
method_setImplementation設(shè)置方法的實(shí)現(xiàn)
method_exchangeImplementations替換方法的實(shí)現(xiàn)
-
method_系列函數(shù)關(guān)注于方法內(nèi)部,如果方法的參數(shù)及返回值類型和方法的實(shí)現(xiàn)
5.property_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
property_getName獲取屬性名
property_getAttributes獲取屬性的特性列表
property_copyAttributeList拷貝屬性的特性列表
property_copyAttributeValue拷貝屬性中某特性的值
-
property_系類函數(shù)關(guān)注與屬性*內(nèi)部,如屬性的特性等
6.protocol_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
protocol_conformsToProtocol判斷一個(gè)協(xié)議是否遵循另一個(gè)協(xié)議
protocol_isEqual判斷兩個(gè)協(xié)議是否一致
protocol_getName獲取協(xié)議名稱
protocol_copyPropertyList拷貝協(xié)議的屬性列表
protocol_copyProtocolList拷貝某協(xié)議所遵循的協(xié)議列表
protocol_copyMethodDescriptionList拷貝協(xié)議的方法列表
protocol_addProtocol為一個(gè)協(xié)議遵循另一協(xié)議
protocol_addProperty為協(xié)議添加屬性
protocol_getProperty獲取協(xié)議中的某個(gè)屬性
protocol_addMethodDescription為協(xié)議添加方法描述
protocol_getMethodDescription獲取協(xié)議中某方法的描述
7.ivar_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
ivar_getName獲取Ivar名稱
ivar_getTypeEncoding獲取類型編碼
ivar_getOffset獲取偏移量
8.sel_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
sel_getName獲取名稱
sel_getUid注冊方法
sel_registerName注冊方法
sel_isEqual判斷方法是否相等
9.imp_xxx 系列函數(shù)
函數(shù)名稱函數(shù)作用
imp_implementationWithBlock通過代碼塊創(chuàng)建IMP
imp_getBlock獲取函數(shù)指針中的代碼塊
imp_removeBlock移除IMP中的代碼塊