In obj-c, how can I call
[myClass myString];
where myString = @"myMethod";
Which should be the equivalent of [myClass myMethod];
Not sure if this kind of meta language manipulation is possible.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
[myClass class]returns the metaclass, class methods are called on the metaclass. E.g.EDIT: I misread the question. Use
NSSelectorFromStringto get a SEL from an NSString. That’s documented in Apple’s Foundation Functions Reference where you’ll also seeNSClassFromString,NSStringFromClass,NSStringFromSelector,NSStringFromProtocolandNSProtocolFromStringamongst others.