IMP用法

作者: elephant0001 | 来源:发表于2019-03-12 08:59 被阅读0次

/// 请求回调 通用处理

- (void)makeCommonResponse:(id)responseObject selector:(SEL)selector {

    int code = [response ObjectintForKey:@"status"];

    NSString *msg = [response ObjectstringForKey:@"msg"];

    if(code ==200) {

        IMP imp = [self methodForSelector:selector];

        void(*func)(id,SEL,id) = (void*)imp;

        func(self, selector, responseObject);

    }

}

可以调用传过来的 方法!

相关文章

  • IMP用法

    /// 请求回调 通用处理 - (void)makeCommonResponse:(id)responseObje...

  • 2018-07-25

    python 合并 pdf 文件 使用pdfrw 模块可可以快速打到目的,具体用法: from pdfrw imp...

  • 数据可视化之matplotlib画图(二)

    今天来到了第二篇,上次简单介绍了一下matplotlib的基本用法,今天继续看看它的使用 先看代码 imp...

  • - (IMP)methodForSelector与+ (IMP)

    浮于表面探究问题不失为一种方法,但是弄清楚本质才是真正意义上的解决疑惑。 之前已经写过一篇博客- (IMP)met...

  • - (IMP)methodForSelector与+ (IMP)

    导语 今天在编码的时候,无意间看到了- (IMP)methodForSelector函数,让我联想到平时经常用的+...

  • IMP

    IMP定义在runtime的objc.h中,定义如下: typedef说明形式:typedef 返回类型(新类型...

  • IMP

    IMPTest声明方法 新建IMPTest类,创建方法 ViewController调用方法 结果输出

  • IMP

    一.什么是IMP IMP是”implementation”的缩写,它是objetive-C 方法(method)实...

  • imp

    imp 重载模块功能from imp import reload当在shell中使用一个模块,原始代码改了,要使用...

  • runTime class_addMethod

    class_addMethod(Class cls, SEL name, IMP imp, const char ...

网友评论

      本文标题:IMP用法

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