30 lines
716 B
Objective-C
30 lines
716 B
Objective-C
//
|
|
// UIViewController+Swizzling.m
|
|
// IfishTests
|
|
//
|
|
// Created by JiangXuefei on 2019/3/13.
|
|
// Copyright © 2019年 lianlian. All rights reserved.
|
|
//
|
|
|
|
#import "UIViewController+Swizzling.h"
|
|
#import <objc/runtime.h>
|
|
|
|
@implementation UIViewController (Swizzling)
|
|
|
|
+ (void)load
|
|
{
|
|
#ifdef DEBUG
|
|
Method viewWillAppear = class_getInstanceMethod(self, @selector(viewWillAppear:));
|
|
Method logViewWillAppear = class_getInstanceMethod(self, @selector(logViewWillAppear:));
|
|
method_exchangeImplementations(viewWillAppear, logViewWillAppear);
|
|
#endif
|
|
}
|
|
|
|
- (void)logViewWillAppear:(BOOL)animated
|
|
{
|
|
NSLog(@"========>%@ will appear",NSStringFromClass([self class]));
|
|
[self logViewWillAppear:animated];
|
|
}
|
|
|
|
@end
|