Skip to content

Instantly share code, notes, and snippets.

@onevcat
Created April 22, 2012 09:16
Show Gist options
  • Save onevcat/2462898 to your computer and use it in GitHub Desktop.
Save onevcat/2462898 to your computer and use it in GitHub Desktop.
swizze
+(BOOL)swizze {
Method oldMethod = class_getInstanceMethod(self, @selector(loadNibNamed:owner:options:));
if (!oldMethod) {
return NO;
}
Method newMethod = class_getInstanceMethod(self, @selector(loadPadNibNamed:owner:options:));
if (!newMethod) {
return NO;
}
method_exchangeImplementations(oldMethod, newMethod);
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment