美文网首页
iOS中Category方法同名原类方法,如何调用原类方法?

iOS中Category方法同名原类方法,如何调用原类方法?

作者: 峰云逸飞 | 来源:发表于2018-12-25 20:30 被阅读22次

    iOS中Category方法调用Category方法,调用不到原类方法,如何调用原类方法

    #pragma clang diagnostic push

    #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"

    - (void)beginRefresh

    {

        u_intcount =0;

        MethodcurrentMethod =nil;

        Method*methods =class_copyMethodList(self.class, &count);

        for(inti=count-1; i>0; i--) {

            if(method_getName(methods[i]) ==_cmd) {

                currentMethod = methods[i];

                break;

            }

        }

        ((void(*)(id,SEL))method_getImplementation(currentMethod))(self,method_getName(currentMethod));

    }

    #pragma clang diagnostic pop

    相关文章

      网友评论

          本文标题:iOS中Category方法同名原类方法,如何调用原类方法?

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