Skip to content

Instantly share code, notes, and snippets.

@qy1010
Created July 2, 2019 09:21
Show Gist options
  • Save qy1010/4030c11e0b0611b4a0dea3dfe4e5b94b to your computer and use it in GitHub Desktop.
Save qy1010/4030c11e0b0611b4a0dea3dfe4e5b94b to your computer and use it in GitHub Desktop.
反射 init & invoke
//反射调用
Class <#your class#> = NSClassFromString(<#your class#>);
id <#instance#>= [[<#your class#> alloc] init];
SEL selector = NSSelectorFromString(<#CallFunc#>);
[<#instance#> performSelector:selector withObject:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment