SEL selector = NSSelectorFromString(@"方法名"); if ([self respondsToSelector:selector]){ //判断是否存在这个方法 IMP imp = [self methodForSelector:selector]; imp(); }
常用于 web与objective-c方法交互