How do I get a selector from its name?

删除回忆录丶 提交于 2019-12-30 18:00:08

问题


I have an NSString containing the name of a selector I would like to call with performSelector. How can I get a reference to the selector from the string?


回答1:


NSSelectorFromString(name)




回答2:


Could use NSSelectorFromString.

Probably inefficient as parameterizing a SEL is preferred.



来源:https://stackoverflow.com/questions/1174985/how-do-i-get-a-selector-from-its-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!