美文网首页
iOS method_t

iOS method_t

作者: 孙掌门 | 来源:发表于2020-02-07 18:38 被阅读0次

iOS method_t

我们查看 OBJC 源码


struct method_t {
    SEL name;
    const char *types;
    MethodListIMP imp;

    struct SortBySELAddress :
        public std::binary_function<const method_t&,
                                    const method_t&, bool>
    {
        bool operator() (const method_t& lhs,
                         const method_t& rhs)
        { return lhs.name < rhs.name; }
    };
};

主要看前三个属性。


1. SEL name; 代表名字
2. const char *types;代表这个方法的参数,返回值类型
3. MethodListIMP imp;函数指针,保存着函数的地址,用于方法的调用


从源码的 method 结构体可以知道,一个方法主要存放着方法的名字,参数类型,返回值类型,和这个方法的地址

相关文章

  • iOS 底层 method_t 中的 types

    iOS 底层 method_t 中的 types 上篇我们说到,method_t 其实就是一个结构体,存储着方法的...

  • iOS method_t

    iOS method_t 我们查看 OBJC 源码 主要看前三个属性。 从源码的 method 结构体可以知道,一...

  • iOS method_t

    method_t 是对方法/函数的封装 SEL代表方法/函数名,一般叫选择器(selector),底层结构类似ch...

  • method_t

    ?method_t是对方法\函数的封装 /// struct method_t { SEL name; //函...

  • Runtime底层解析 - 方法:method_t

    method_t method_t是对方法\函数的封装 断点查看方法 仿源码自定义ClassInfo.h,从源码中...

  • runtime-method

    method_t数据结构 SEL SEL获取 SEL转字符串 types 方法编码

  • 一、初识Runtime数据结构

    Runtime的数据结构主要包括objc_object、objc_class、isa 指针、method_t对象。...

  • 二十、Runtime之(四)方法-method

    一、method_t结构 1.1 IMP的本质就是函数地址(指向函数的指针) 1.2 Type Encoding

  • RunTime

    数据结构 objc_object objc_class isa指针 method_t objc_object id...

  • iOS-面试题2-Runtime、Runloop

    目录: isa存储信息分析 Class的内部结构、method_t、cache objc_msgSend底层调用流...

网友评论

      本文标题:iOS method_t

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