forked from bestswifter/MySampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOther.m
More file actions
38 lines (28 loc) · 700 Bytes
/
Other.m
File metadata and controls
38 lines (28 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Normal.m
// load
//
// Created by 张星宇 on 16/2/1.
// Copyright © 2016年 zxy. All rights reserved.
//
#import "Other.h"
#import <objc/runtime.h>
@implementation Other
static NSString *name;
+ (void)load {
name = @"Other";
NSLog(@"Load Class Other");
Method originalFunc = class_getInstanceMethod([self class], @selector(originalFunc));
Method swizzledFunc = class_getInstanceMethod([self class], @selector(swizzledFunc));
method_exchangeImplementations(originalFunc, swizzledFunc);
}
+ (void)printName {
NSLog(@"%@",name);
}
- (void)originalFunc {
NSLog(@"Original Output");
}
- (void)swizzledFunc {
NSLog(@"Swizzled Output");
}
@end