Skip to content

Instantly share code, notes, and snippets.

@threetreeslight
Created January 10, 2015 06:27
Show Gist options
  • Save threetreeslight/80985ab76f132813c00e to your computer and use it in GitHub Desktop.
Save threetreeslight/80985ab76f132813c00e to your computer and use it in GitHub Desktop.
#import "UIViewController+RPRIS.h"
#import <objc/runtime.h>
@implementation UIViewController (Foo)
+ (void)swizzlingMethodViewWillApper
{
Method originalMethod = class_getInstanceMethod(self, viewWillApper:);
Method swizzledMethod = class_getInstanceMethod(self, foo_viewWillApper:);
method_exchangeImplementations(originalMethod, swizzledMethod);
}
- (void)foo_viewWillAppear:(BOOL)animated
{
[self foo_viewWillAppear:animated];
NSLog(@"swizzled viewWillApper Yeah!!");
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment