Is it possible to pass a method as an argument in Objective-C?

后端 未结 3 2182
说谎
说谎 2020-12-25 13:05

I have a method that varies by a single method call inside, and I\'d like to pass the method/signature of the method that it varies by as an argument... is this possible in

3条回答
  •  盖世英雄少女心
    2020-12-25 13:45

    Or if you're using the fooWithMethod:(SEL)selector approach, just do [myObject performSelector:selector] on it, if it has no other arguments.

    See NSObject for details.

提交回复
热议问题