objective c swizzle method
C
#import <objc/runtime.h>
@implementation UIViewController (Tracking)
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
SEL originalSelector = @selector(viewWillAppear:);
SEL swizzledSelector = @selector(xxx_viewWillAppear:);
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
// When swizzling a class method, use the following:
// Class class = object_getClass((id)self);
// ...
// Method originalMethod = class_getClassMethod(class, originalSelector);
// Method swizzledMethod = class_getClassMethod(class, swizzledSelector);
BOOL didAddMethod =
class_addMethod(class,
originalSelector,
method_getImplementation(swizzledMethod),
method_getTypeEncoding(swizzledMethod));
if (didAddMethod) {
class_replaceMethod(class,
swizzledSelector,
method_getImplementation(originalMethod),
method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swizzledMethod);
}
});
}
#pragma mark - Method Swizzling
- (void)xxx_viewWillAppear:(BOOL)animated {
[self xxx_viewWillAppear:animated];
NSLog(@"viewWillAppear: %@", self);
}
@end
Also in C:
- Title
- bubble sort time complexity
- Category
- C
- Title
- unordered_map
- Category
- C
- Title
- chat
- Category
- C
- Title
- for loop in c
- Category
- C
- Title
- Assign integer value to pointer?
- Category
- C
- Title
- How to make a printf in c
- Category
- C
- Title
- pangram program in c
- Category
- C
- Title
- what is restrict keyword in c
- Category
- C
- Title
- curl post request
- Category
- C
- Title
- d3 box shadow
- Category
- C
- Title
- write in a file using c
- Category
- C
- Title
- first person view unity
- Category
- C
- Title
- if statement shorthand c
- Category
- C
- Title
- c isdigit function
- Category
- C
- Title
- slurm array job
- Category
- C
- Title
- arduino digital io pins
- Category
- C
- Title
- last element from list javascript
- Category
- C
- Title
- c struct
- Category
- C
- Title
- arduino knn
- Category
- C
- Title
- declare variable in c
- Category
- C
- Title
- where is /dev/kvm
- Category
- C
- Title
- msdos
- Category
- C
- Title
- XAudio2 C
- Category
- C
- Title
- install postgres on linux
- Category
- C
- Title
- multiplication in c
- Category
- C
- Title
- tmux how to kill all sessions
- Category
- C
- Title
- typedef vs #define
- Category
- C
- Title
- maximo comun divisor
- Category
- C
- Title
- check if string in string c
- Category
- C
- Title
- vector aleatorio sin repetir
- Category
- C
- Title
- a enum data type in c
- Category
- C
- Title
- struct in C
- Category
- C
- Title
- windowns 10 allow ping
- Category
- C
- Title
- stack
- Category
- C
- Title
- powershell list big files
- Category
- C
- Title
- heitai bestial
- Category
- C
- Title
- ModuleNotFoundError: No module named 'easydict'
- Category
- C
- Title
- read files in c
- Category
- C
- Title
- bella ciao lyrics
- Category
- C
- Title
- arduino millis()
- Category
- C
- Title
- c allocate array
- Category
- C
- Title
- uint32_t extract first bits
- Category
- C
- Title
- CL/cl.h: No such file or directory
- Category
- C
- Title
- tar cmd
- Category
- C
- Title
- what is the meaningof noremap
- Category
- C
- Title
- oop244
- Category
- C
- Title
- pass the pointer in C
- Category
- C
- Title
- how to open a website in c
- Category
- C
- Title
- add border to image android
- Category
- C
- Title
- remove element queue
- Category
- C
- Title
- reverse function in c
- Category
- C
- Title
- how to rebasde
- Category
- C
- Title
- for loop c
- Category
- C
- Title
- iterate through map
- Category
- C
- Title
- arduino digital read
- Category
- C
- Title
- delete string function in c
- Category
- C
- Title
- fa fa-facebook
- Category
- C
- Title
- assert() in c
- Category
- C
- Title
- function pointer c
- Category
- C
- Title
- 1 212 32123 4321234 543212345 in c
- Category
- C
- Title
- cantidad de digitos recursiva
- Category
- C
- Title
- error: ‘cout’ was not declared in this scope
- Category
- C
- Title
- code: 'EADDRINUSE', [0] errno: 'EADDRINUSE', [0] syscall: 'listen', [0] address: '::', [0] port: 5000
- Category
- C
- Title
- how to sleep in c
- Category
- C
- Title
- hello world
- Category
- C
- Title
- how to use ? in c
- Category
- C
- Title
- program using if statement in c whether numnber is less eqaul to greater than 50
- Category
- C
- Title
- c program to find the sum of given number using recursion
- Category
- C
- Title
- how to feed a char array to function in C
- Category
- C
- Title
- primo
- Category
- C
- Title
- get a remote branch git
- Category
- C
- Title
- how to store a user input with spaces in c
- Category
- C
- Title
- how to print in c
- Category
- C
- Title
- arduino digital input pins
- Category
- C
- Title
- resto de division recursiva
- Category
- C
- Title
- how to login to another user in powershell
- Category
- C
- Title
- how can i remove a specific item from an array
- Category
- C
- Title
- how to put quotes inside string c
- Category
- C
- Title
- conda windows 10 from pip._internal.cli.main import main ModuleNotFoundError
- Category
- C
- Title
- Declare macro
- Category
- C
- Title
- how to free memory in c
- Category
- C
- Title
- declare integer c
- Category
- C
- Title
- strrev in c
- Category
- C
- Title
- 'keras.backend' is not a package
- Category
- C
- Title
- xmlns='' was not expected
- Category
- C
- Title
- get_session` is not available when using TensorFlow 2.0.
- Category
- C
- Title
- c fill 2d array
- Category
- C
- Title
- c program to find the sum of given number
- Category
- C
- Title
- compare two chars c
- Category
- C
- Title
- azure storage emulator config
- Category
- C
- Title
- how to call the tkinter insert command from another class
- Category
- C
- Title
- hentai clochette
- Category
- C
- Title
- how to represent unsigned char with % c
- Category
- C
- Title
- hostbuilder add environment variables
- Category
- C
- Title
- confirm sweet alert
- Category
- C
- Title
- Fibonacci program c pthread
- Category
- C
- Title
- write a binary file c
- Category
- C
- Title
- sdl bouton
- Category
- C
- Title
- tkinter create_line
- Category
- C
- Title
- c substring
- Category
- C