-
-
Save yusuke024/42b0ac48a88c313cd304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import ObjectiveC; | |
| @interface MyClass : NSObject | |
| @end | |
| @implementation MyClass | |
| + (void)methodA { | |
| Method mb = class_getClassMethod([self class], @selector(methodB:)); | |
| BOOL (* action)(id, Method, NSNumber *) = (BOOL (*)(id, Method, NSNumber *))method_invoke; | |
| BOOL returnValue = action([self class], mb, [NSNumber numberWithBool:YES]); | |
| method_getNumberOfArguments(mb); // number of args | |
| method_getArgumentType(mb, 2, dst, 256); // arg type | |
| } | |
| + (BOOL)methodB:(NSNumber *)a { | |
| return [a boolValue]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment