ios 利用runtime 机制 交换系统内部方法的实现
2015-12-23 10:37
543 查看
//获取类
方法
Method method =class_getInstanceMethod([UIView
class], @selector(initWithFrame:));
//
替换 系统内部方法
Method new =class_getInstanceMethod([UIButton
class], @selector(buttonWithType:));
method_setImplementation(method,
method_getImplementation(new));
//
两个方法交换实现
// method_exchangeImplementations(<#Method m1#>, <#Method m2#>)
方法
Method method =class_getInstanceMethod([UIView
class], @selector(initWithFrame:));
//
替换 系统内部方法
Method new =class_getInstanceMethod([UIButton
class], @selector(buttonWithType:));
method_setImplementation(method,
method_getImplementation(new));
//
两个方法交换实现
// method_exchangeImplementations(<#Method m1#>, <#Method m2#>)
相关文章推荐
- iOS蓝牙Service定义对照表
- AutoLayout 和 autoresizing
- iOS 无线部署
- 部分密文显示身份证号及姓名等iOS
- Ios 真机调试
- iOS使用Workspace来管理多项目
- 关于iOS开发中使用到的AES加密和SHA256加密的使用
- iOS学习之 播放gif动画
- IOS版添加phonegap-视频播放插件教程
- BIOS启动报警声全集
- iOS 导航栏遮挡问题 --- iOS开发系列 ---项目中成长的知识七
- iOS8 定位问题
- IOS移除NSAssert& NSLog
- iOS开发笔记- NSStringCompareOptions 使用
- iOS xcode 文件中常见后缀名的释义
- Ios开发之多线程编程——NSThread
- iOS---取出字符串中的数字
- mac开发 ios开发
- iOS-delegate设计模式
- IOS本地定时推送通知