[转]object-c 的reflection
2011-04-22 23:40 wuxiaoqqqq 阅读(312) 评论(0) 编辑 收藏 举报// Without reflection
Foo *foo = [[Foo alloc] init];
[foo hello];
// With reflection
Class cls = NSClassFromString(@"Foo");
id foo = [[cls alloc] init];
SEL selector = NSSelectorFromString(@"hello");
[foo performSelector:selector withObject:nil];