• Method Swizzling 为什么要先调用 class_addMethod?


    class_addMethod will add an override of a superclass's implementation, 

    but will not replace an existing implementation in this class. 

    To change an existing implementation, use method_setImplementation.

    给指定Class添加一个SEL的实现(或者说是SEL和指定IMP的绑定),添加成功返回YES,SEL已经存在或添加失败返回NO。
    它有两个需要注意的点:

    如果该SEL在父类中有实现,则会添加一个覆盖父类的方法;
    如果该Class中已经有SEL,则返回NO。

    执行class_addMethod能避免干扰到父类,这也是为什么推荐大家尽量先使用class_addMethod的原因

  • 相关阅读:
    oracle Blob处理
    开机启动
    获取本机IP
    MSSQL通用分页过程
    转:Delphi2010小写金额转大写金额的源代码
    HWND Handle HModule区别
    常见问题
    Oracle ORA-01033: 错误解决办法
    lvs- lvs(DR模式)+keepalived
    lb-常用的负载均衡软件
  • 原文地址:https://www.cnblogs.com/feng9exe/p/15906185.html
Copyright © 2020-2023  润新知