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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

linux - phpmyadmin, neginx error.log - Check group www-data has read access and open_basedir -