How do I get a selector from its name?

前端 未结 2 910
南笙
南笙 2021-01-18 04:19

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?

相关标签:
2条回答
  • 2021-01-18 04:28

    NSSelectorFromString(name)

    0 讨论(0)
  • 2021-01-18 04:35

    Could use NSSelectorFromString.

    Probably inefficient as parameterizing a SEL is preferred.

    0 讨论(0)
提交回复
热议问题