// 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];

相关文章:

  • 2022-12-23
  • 2021-10-19
  • 2021-10-07
  • 2021-12-23
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2021-11-09
猜你喜欢
  • 2021-08-26
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
  • 2022-03-06
  • 2021-07-24
  • 2021-08-13
相关资源
相似解决方案