ios runtime系列 method_exchangeImplementations方法
2017-02-07 15:28
274 查看
- (void)viewDidLoad
{
[super viewDidLoad];
Method m1 = class_getInstanceMethod([self class], @selector(method1));
Method m2 = class_getInstanceMethod([self class], @selector(method2));
[self method1];
[self method2];
method_exchangeImplementations(m1, m2);
[self method1];
[self method2];
}
- (void)method1
{
NSLog(@"%s", __func__);
}
- (void)method2
{
NSLog(@"%s", __func__);
}
{
[super viewDidLoad];
Method m1 = class_getInstanceMethod([self class], @selector(method1));
Method m2 = class_getInstanceMethod([self class], @selector(method2));
[self method1];
[self method2];
method_exchangeImplementations(m1, m2);
[self method1];
[self method2];
}
- (void)method1
{
NSLog(@"%s", __func__);
}
- (void)method2
{
NSLog(@"%s", __func__);
}
相关文章推荐
- ios runtime swizMethod 拦截交换方法执行
- iOS开发使用 runtime 方法中的 class_copyIvarList,class_copyMethodList 方法时导致内存泄漏问题
- 对iOS runtime methodForSelector 方法的一点理解2
- runtime系列3--Dynamic Method Resolution-方法的动态决议
- iOS 开发 深入浅出Runtime运行时之方法动态处理(Dynamic Method Resolution)详解
- IOS系列——自定义外部方法供其他类里面的对象调用
- 【iOS开发系列】NSObject方法介绍
- iOS 万能跳转界面方法 (runtime实用篇一)
- iOS 万能跳转界面方法 (runtime实用篇一)
- iOS 万能跳转界面方法 (runtime实用篇一)
- 二、ArcGIS Runtime SDK for iOS 100.2.1教程系列之点击图层元素检索并高亮
- iOS runtime ~ objc_setAssociatedObject方法详解
- iOS-runtime-根据协议名调某一个类有与协议里面放的相同的方法
- iOS_Runtime2_方法交换
- iOS 开发 深入浅出Runtime运行时之官方翻译--动态方法处理
- ArcGIS Runtime SDK for iOS开发系列教程(7)——GeometryService与GeometryEngine使用
- IOS 中runtime使用方法整理
- iOS runtime方法详解之对象关联
- iOS 使用class_copyPropertyList等runtime方法的注意事项
- iOS 万能跳转界面方法 (runtime实用篇一)