函数与字符串的相互转化,@selecte函数转化为字符串传递,字符串转化为@select接收

@selecte函数转化为字符串传递



-(void)passFun

{

     [Class  recieveFun:NSStringFromSelector(@selector(fun))];

}




字符串转化为@select接收


-(void)recieveFun:(NSString)funString

{

  SEL selector = NSSelectorFromString(funString);

    

  [self.performFunTarget performSelector:selector withObject:sender];

}

你可能感兴趣的:(Class,fun)