ios运行时替换函数
2013-04-10 13:11
106 查看
#include
void Swizzle(Class c, SEL origSEL, SEL newSEL){
Method origMethod = class_getInstanceMethod(c, origSEL);
Method newMethod = class_getInstanceMethod(c, newSEL);
if(class_addMethod(c, origSEL, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
class_replaceMethod(c, newSEL, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
else
method_exchangeImplementations(origMethod, newMethod);
}
相关文章推荐
- iOS运行时函数替换框架——RSSwizzle
- ios 引入第三方库 运行时找不到函数实现
- linux下实现在程序运行时的函数替换(热补丁)【转】
- C++在运行状态下修改替换函数逻辑
- iOS运行时(runtime)探究二:主要函数
- javascript的onbeforeunload函数在IOS上运行
- 函数替换 oc的运行时
- 三十,iOS当使用运行时替换了NSArrary的方法之后,弹出键盘进入后台然后在进入前台会出现崩溃的问题
- iOS 通知观察者的被调函数不一定运行在主线程
- iOS 通知观察者的被调函数不一定运行在主线程
- linux下实现在程序运行时的函数替换(热补丁)
- iOS方法替换的函数
- IOS - 运行时 (常用函数)
- iOS 通知观察者的被调函数不一定运行在主线程
- IOS开发模块总结(二)后台运行程序(1) 后台运行程序详解
- 正试图在 os 加载程序锁内执行托管代码。不要尝试在 DllMain 或映像初始化函数内运行托管代码
- iOS_数学函数数学函数
- iOS运行时的用途三 -- 获得属性名,方法名,成员变量名
- iOS-Swift-函数2
- iOS 运行时runtime应用之二--在category中使用运行时API给类添加属性