@interface Person : NSObject
-(void)test;
@end
@implementation Person
-(void)test{
NSLog(@"test");
}
int main(int argc, const char * argv[]) {
@autoreleasepool {
Person *p = [Person new];
//手动的把test包装成SEL类型
SEL s1= @selector(test);
[p performSelector:s1];
//这两句相当于[p test];
}
return 0;
} |
|