项目设计到多个平台,所有底层函数名都是统一的,这就要求IOS这边的函数必须动态执行。

-(void)executefunction:(NSString *)funciontName
{
    NSLog(@"%@",funciontName);
    [self performSelector:(SEL)("test_function")];
    char *f="test_function";
    [self performSelector:(SEL)(f)];
    
    //使用NSString
    [self performSelector:NSSelectorFromString(funciontName)];
    //objc_msgSend(delegateObject, (SEL)method);
}
-(void)test_function
{
    NSLog(@"----fsdaf");
}


相关文章:

  • 2021-09-25
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-02-24
  • 2021-11-09
猜你喜欢
  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-10-30
相关资源
相似解决方案