当前位置: 移动技术网 > IT编程>移动开发>IOS > super performSelector: 解决调用父类私有方法的问题

super performSelector: 解决调用父类私有方法的问题

2019年09月25日  | 移动技术网IT编程  | 我要评论

哇靠是什么意思,4008-000-000,洋娃娃王妃

super performselector: 解决objc调用父类私有方法的问题

  objc中[super performselector: ...]并不会像其他语言一样能良好的工作。super只是编译器符号。

  想要安全和快速的调用父类的方法是直接调用父类方法的函数地址:

    method md = class_getinstancemethod(class_getsuperclass(self.class), @selector(xxxxx:));

    imp imp = method_getimplementation(md);

    void(*super_imp)(id,sel,id) = (void*)imp;

    super_imp(self, @selector(xxxxx:), 参数1, 参数2, 参数3,... ...);

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网