Skip to content

Instantly share code, notes, and snippets.

@zhaoyk
Created March 28, 2014 02:57
Show Gist options
  • Select an option

  • Save zhaoyk/9824287 to your computer and use it in GitHub Desktop.

Select an option

Save zhaoyk/9824287 to your computer and use it in GitHub Desktop.
call any selector, no error
// same as [obj someSelector]
SEL selector = @selector(someSelector);
IMP imp = [obj methodForSelector:selector];
void (*func)(id, SEL) = (void *)imp;
func(obj, selector);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment