美文网首页
oc,你关注的runtime

oc,你关注的runtime

作者: 透头 | 来源:发表于2016-09-14 14:07 被阅读22次

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

实例

相关文章

网友评论

      本文标题:oc,你关注的runtime

      本文链接:https://www.haomeiwen.com/subject/fqipettx.html