objective c - iOS 7.1 - How to call a selector without knowing name at compile time? -
when code gets point in execution, needs call selector. problem is, selector call, along object passed in performselector, changes each time. candidate selectors functions written ahead of time, how can convert variable (e.g.: nsstring* or enum telling program selector call) name of selector, without using gigantic switch statement?
sel selector = nsselectorfromstring(aselectorname); if ([self respondstoselector: selector]) { [self performselector: selector]; }
Comments
Post a Comment