Method類型是一個objc_method結構體指針,而結構體objc_method有三個成員:
An opaque type that represents a method in a class definition.typedef struct objc_method *Method;struct objc_method
SEL method_name;
// 方法名稱char *method_typesE;
// 參數和返回類型的描述字串,平常我們調用方法傳遞的參數和調用方法返回值IMP method_imp;
// 方法的具體的實現的指針,指向了方法實現的指針
Method所有方法
// 函數調用,但是不接收返回值類型為結構體
method_invoke
// 函數調用,但是接收返回值類型為結構體
method_invoke_stret
// 獲取函數名
method_getName
// 獲取函數實現IMP
method_getImplementation
// 獲取函數type encoding
method_getTypeEncoding
// 復制返回值類型
method_copyReturnType
// 復制參數類型
method_copyArgumentType
// 獲取返回值類型
method_getReturnType
// 獲取參數個數
method_getNumberOfArguments
// 獲取函數參數類型
method_getArgumentType
// 獲取函數描述
method_getDescription
// 設置函數實現IMP
method_setImplementation
// 交換函數的實現IMP
method_exchangeImplementations